From 5e42b68f47a850a09d624819fad116d4ef6f3ed0 Mon Sep 17 00:00:00 2001 From: Folkert Kevelam Date: Fri, 27 Jun 2025 20:46:07 +0200 Subject: [PATCH] Add basic bit types --- runtime/adainclude/interfaces.ads | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/runtime/adainclude/interfaces.ads b/runtime/adainclude/interfaces.ads index 4f56bb9..dc63d8d 100644 --- a/runtime/adainclude/interfaces.ads +++ b/runtime/adainclude/interfaces.ads @@ -1,18 +1,29 @@ package Interfaces with Pure is - type Integer_32 is range -2**31 .. 2**31 - 1; - type Unsigned_32 is mod 2**32; + type Bit_1 is mod 2**1 + with Size => 1; + type Bit_2 is mod 2**2 + with Size => 2; + type Bit_3 is mod 2**3 + with Size => 3; + type Bit_4 is mod 2**4 + with Size => 4; - function Shift_Left (Value : Unsigned_32; Amount : Natural) - return Unsigned_32 with Import, Convention => Intrinsic; - function Shift_Right (Value : Unsigned_32; Amount : Natural) - return Unsigned_32 with Import, Convention => Intrinsic; - function Shift_Right_Arithmetic (Value : Unsigned_32; Amount : Natural) - return Unsigned_32 with Import, Convention => Intrinsic; - function Rotate_Left (Value : Unsigned_32; Amount : Natural) - return Unsigned_32 with Import, Convention => Intrinsic; - function Rotate_Right (Value : Unsigned_32; Amount : Natural) - return Unsigned_32 with Import, Convention => Intrinsic; + type Bit_31 is mod 2**32 + with Size => 31; + type Bit_32 is mod 2**32 + with Size => 32; + + function Shift_Left (Value : Bit_32; Amount : Natural) + return Bit_32 with Import, Convention => Intrinsic; + function Shift_Right (Value : Bit_32; Amount : Natural) + return Bit_32 with Import, Convention => Intrinsic; + function Shift_Right_Arithmetic (Value : Bit_32; Amount : Natural) + return Bit_32 with Import, Convention => Intrinsic; + function Rotate_Left (Value : Bit_32; Amount : Natural) + return Bit_32 with Import, Convention => Intrinsic; + function Rotate_Right (Value : Bit_32; Amount : Natural) + return Bit_32 with Import, Convention => Intrinsic; end Interfaces;