Erik Baigar wrote:
> Dear Ada users,
>
> in ****ting an application from Meridian's Ada83 to gnat3.15 I
> encountered some issues with the system.bit_ops...
>
> Bit_And ( MEMORY (OPERAND_ADDRESS)'Address,18, ACCUMULATOR'Address,18,
> ACCUMULATOR'Address);
>
> ... This code works well
> on the Intel (little endian) platform but fails on SPARC (big endian).
> It required some investigation to locate the problem, but replacing
> the length 18 by 32 (all are integers here), i.e. using
>
> Bit_And ( MEMORY (OPERAND_ADDRESS)'Address,32, ACCUMULATOR'Address,32,
> ACCUMULATOR'Address);
>
> solved the problem and the code now runs on little and big endian
> systems.
Anything that accesses a variable using Variable'Address but then
operates only on a part of the variable (eg. 18 bits of a 32-bit
variable) sounds very likely to have problems with endianness, if
the storage unit is smaller than the size of the variable.
Did you have a question to ask, or did you just want to re****t this
problem and your solution?
I think that your program could be made more ****table by avoiding
'Address (and, of course, System.Bit_Ops) and using instead modular
types (not available in Ada83) and their predefined bitwise "and"
and "or" operations.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @[EMAIL PROTECTED]
.


|