Thank you for your quick answer.
Can I use Unsigned_Byte_T to read in a byte from a file
as in C? I haven't looked into this yet.
On Sun, 25 Mar 2012, Niklas Holsti wrote:
> On 12-03-25 17:28 , Michael Moeller wrote:
>> I'm wondering what this code in C looks like translated to Ada:
>> unsigned char x, y, z;
>> z = x ^ y;
>> Oddly enough, none of the manuals I have covers simple numerical
>> xor of two numbers stored in variables.
> Use a modular integer type to get the XOR operation:
> -- begin example
> procedure Show_Xor
> type Unsigned_Byte_T is mod 256;
> x, y, z : Unsigned_Byte_T;
> x := 26;
> y := 33;
> z := x xor y;
> end Show_Xor;
> --end example
> If you also want shift and rotate operations, start from the types defined in
> the Interfaces package, such as Interfaces.Unsigned_8 and other sizes.
> Niklas Holsti
> Tidorum Ltd
> niklas holsti tidorum fi
> . @ .