Bitwise Operations in Ada

ada, bit-manipulation

Solution

Ada doesn't provide logical (bit-wise) operations on integer types, it provides them on modular types. Here's the section in the reference manual.

Problem

Is there a tutorial somewhere that explains on which datatypes bitwise operations can be used? I don't know why Lady Ada thinks that I cannot bitwise OR two Standard.Integer... ``` $ gnatmake test.adb gcc -c test.adb test.adb:50:77: there is no applicable operator "Or" for type "Standard.Integer" gnatmake: "test.adb" compilation error ``` Really? I excused the compiler for not being able to AND/OR enumerated data types. I excused the compiler for not being able to perform bitwise operations on Character type. I excused the compiler for not being able to convert from Unsigned_8 to Character in what I thought was the obvious way. But this is inexcusable.

Original source