------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . L I T T L E _ E N D I A N _ I N T E R F A C E S -- -- -- -- S p e c -- -- -- -- $Revision: 1.0 $ -- -- -- -- Copyright (C) 1999 Michael Roe -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This package provides functions for reading file or packet formats that -- -- use a 'little endian' representation for integers, that is with the -- -- least significant octet first. These functions will work correctly on -- -- both big-endian and little-endian machines; in the former case, they -- -- swap the order of the bytes. -- with Interfaces; use Interfaces; package GNAT.Little_Endian_Interfaces is type Octets_2 is array (0 .. 1) of Interfaces.Unsigned_8; type Octets_4 is array (0 .. 3) of Interfaces.Unsigned_8; type Octets_8 is array (0 .. 7) of Interfaces.Unsigned_8; function To_Unsigned_16 (X : Octets_2) return Interfaces.Unsigned_16; pragma Inline (To_Unsigned_16); function To_Unsigned_32 (X : Octets_4) return Interfaces.Unsigned_32; pragma Inline (To_Unsigned_32); function To_Unsigned_64 (X : Octets_8) return Interfaces.Unsigned_64; pragma Inline (To_Unsigned_64); function To_Octets_2 (X : Unsigned_16) return Octets_2; pragma Inline (To_Octets_2); function To_Octets_4 (X : Unsigned_32) return Octets_4; pragma Inline (To_Octets_4); function To_Octets_8 (X : Unsigned_64) return Octets_8; pragma Inline (To_Octets_8); end GNAT.Little_Endian_Interfaces;