Add Read_LE16/32 and types
diff --git a/src/fs.ads b/src/fs.ads
index 4591a8a..2085490 100644
--- a/src/fs.ads
+++ b/src/fs.ads
@@ -1,7 +1,24 @@
with Interfaces;
+use Interfaces;
+
package FS is
- type Buffer_Type is array (Natural range <>) of Interfaces.Unsigned_8;
+ 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 (Off + 1)), 8) or Unsigned_16 (Buf (Off)));
+
+ function Read_LE32 (Buf : Buffer_Type; Off : Index_Type32) return Unsigned_32
+ is
+ (Shift_Left (Unsigned_32 (Buf (Off + 3)), 24) or
+ Shift_Left (Unsigned_32 (Buf (Off + 2)), 16) or
+ Shift_Left (Unsigned_32 (Buf (Off + 1)), 8) or
+ Unsigned_32 (Buf (Off)));
end FS;