Re: How do you bitwise operations in Ada '83 and '95

"Chris L" <clusardi2k@xxxxxxx> writes:

Also, do you have small coding examples that demonstrate this?

If you just want bitwise logical operators, then you want an array of
Boolean. Probably with pragma Pack. This works in Ada 83, 95, and 05.

If you want to mix bitwise logical operators with arithmetic and the
like, then you want to use modular types, which are not available in
Ada 83.

- Bob

Relevant Pages

  • Re: Any easy/build-in construct to extract submatrices from larger matrix?
    ... Ada 2012 provides a reasonably simple way to do this: ... Specify the type of the Matrix, e.g., ... function Is_Diagonal return Boolean is ... for I in V'Range loop ...
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... compile time, or at run time. ... languages being used: Ada and C++. ... The set of values for the Boolean types are False ... type BA is array of Boolean; ...
  • Re: GNAT (GCC) Profile Guided Compilation
    ... whereas Ada is setting the result into a Boolean variable. ... Niklas Holsti ... this appears to be the biggest cause of the profile guided compilation not working as well for Ada as C++. ...
  • Re: choice_expression
    ... something like Array'Range where the array index type is Boolean. ... notation for the operations Ada conflates. ... This might impose problems once ranges and tests become proper operations. ...
  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... >> A packed array of boolean allocates one storage element to each bit. ... >> provided by Ada so that the program will properly represent ... The following example starts with the creation of a generic package ...