Thomas Heijligen | 62268ee | 2023-11-27 15:10:41 +0000 | [diff] [blame] | 1 | with Interfaces; |
| 2 | |
Nico Huber | 98417fc | 2023-11-30 16:46:25 +0100 | [diff] [blame] | 3 | use Interfaces; |
| 4 | |
Thomas Heijligen | d1e0457 | 2023-11-27 14:28:55 +0000 | [diff] [blame] | 5 | package FS is |
| 6 | |
Nico Huber | 98417fc | 2023-11-30 16:46:25 +0100 | [diff] [blame] | 7 | subtype Index_Type is Natural range 0 .. Natural'Last - 1; |
| 8 | subtype Index_Type16 is Index_Type range 0 .. Index_Type'Last - 1; |
| 9 | subtype Index_Type32 is Index_Type16 range 0 .. Index_Type16'Last - 2; |
| 10 | |
| 11 | type Buffer_Type is array (Index_Type range <>) of Unsigned_8; |
| 12 | |
| 13 | function Read_LE16 (Buf : Buffer_Type; Off : Index_Type16) return Unsigned_16 |
| 14 | is |
| 15 | (Shift_Left (Unsigned_16 (Buf (Off + 1)), 8) or Unsigned_16 (Buf (Off))); |
| 16 | |
| 17 | function Read_LE32 (Buf : Buffer_Type; Off : Index_Type32) return Unsigned_32 |
| 18 | is |
| 19 | (Shift_Left (Unsigned_32 (Buf (Off + 3)), 24) or |
| 20 | Shift_Left (Unsigned_32 (Buf (Off + 2)), 16) or |
| 21 | Shift_Left (Unsigned_32 (Buf (Off + 1)), 8) or |
| 22 | Unsigned_32 (Buf (Off))); |
Thomas Heijligen | d1e0457 | 2023-11-27 14:28:55 +0000 | [diff] [blame] | 23 | |
| 24 | end FS; |