with Interfaces;

use Interfaces;

package FILO is

   type Blockdev_Length is range 0 .. Interfaces.Unsigned_64'Last;
   subtype Blockdev_Offset is Blockdev_Length range 0 .. Blockdev_Length'Last - 1;
   subtype Partition_Length is Blockdev_Length;
   subtype Partition_Offset is Blockdev_Offset;

   BLOCK_SIZE : constant := 512;
   type Block_Offset is range 0 .. Partition_Offset'Last / BLOCK_SIZE;

   subtype Index_Type is Natural range 0 .. Natural'Last - 1;
   subtype Index_Type16 is Index_Type range 0 .. Index_Type'Last - 1;
   subtype Index_Type32 is Index_Type16 range 0 .. Index_Type16'Last - 2;

   type Buffer_Type is array (Index_Type range <>) of Unsigned_8;

   function Read_LE16 (Buf : Buffer_Type; Off : Index_Type16) return Unsigned_16
   is
     (Shift_Left (Unsigned_16 (Buf (Buf'First + Off + 1)), 8) or
      Unsigned_16 (Buf (Buf'First + Off)))
   with
      Pre =>
         Buf'First <= Index_Type16'Last - Off and
         Buf'First + Off + 1 <= Buf'Last;

   function Read_LE32 (Buf : Buffer_Type; Off : Index_Type32) return Unsigned_32
   is
     (Shift_Left (Unsigned_32 (Buf (Buf'First + Off + 3)), 24) or
      Shift_Left (Unsigned_32 (Buf (Buf'First + Off + 2)), 16) or
      Shift_Left (Unsigned_32 (Buf (Buf'First + Off + 1)),  8) or
      Unsigned_32 (Buf (Buf'First + Off)))
   with
      Pre =>
         Buf'First <= Index_Type32'Last - Off and
         Buf'First + Off + 3 <= Buf'Last;

   generic
      type T is mod <>;
   function Gen_Is_Power_Of_2 (Val : T) return Boolean;
   function Gen_Is_Power_Of_2 (Val : T) return Boolean
   is
      (Val /= 0 and (Val and (Val - 1)) = 0);

   function Is_Power_Of_2 is new Gen_Is_Power_Of_2 (Unsigned_16);
   function Is_Power_Of_2 is new Gen_Is_Power_Of_2 (Unsigned_32);

end FILO;
