I am trying to learn Ada, but recources are tough. I have been reading on this subject, but all explanations have been hard for me to understand. I have often seen code like this
type Stream_Element is mod 2 ** Standard'Storage_Unit;
What does this do? I have found an explanation here:
Ada also allows you to define modular types. These types are unsigned and have “wrap-around” semantics. Incrementing beyond the end of an ordinary type causes an exception, but incrementing beyond the end of a modular type wraps around to zero. In addition the operators not, and, or, and xor can be used on modular types to do bitwise manipulation. Figure 11 demonstrates.
This explanation makes sense, but I dont understand the code. what signifigance does the mod 2 ** X
have? what is the mod
for? what does the **
do?