ArmmiteF407 V5.07.02 betas - Library - No Battery and more.


Author Message
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 864
Posted: 06:34am 09 Dec 2023      

Below is from the Micromite manual. The SHIFT operators treat the 64bit number as unsigned. The CMM2 looks like it can handle either treating it as 64bit signed or unsigned. The F4 manual used a lot of the CMM2 manual so probably how the description got changed. H7 came from F4 manual. They all actually operate as per the micromites, so manuals need to be updated. The Picomites likely have the same history so just need the manual updated.
All the manuals have the section 64-bit Unsigned Integers as below, just the description of the shift operator needs fixing.


64-bit Unsigned Integers
The Micromite supports 64-bit signed integers. This means that there are 63 bits for holding the number and
one bit (the most significant bit) which is used to indicate the sign (positive or negative). However it is
possible to use full 64-bit unsigned numbers as long as you do not do any arithmetic on the numbers.
64-bit unsigned numbers can be created using the &H, &O or &B prefixes to a number and these numbers can
be stored in an integer variable. You then have a limited range of operations that you can perform on these
numbers. They are << (shift left), >> (shift right), AND (bitwise and), OR (bitwise or), XOR (bitwise
exclusive or), = (equal to) and <> (not equal to). Arithmetic operators such as +, -, etc may be confused by a
64-bit unsigned number and could return nonsense results.
To display 64-bit unsigned numbers you should use the HEX$(), OCT$() or BIN$() functions.
For example, the following 64-bit unsigned operation will return the expected results:
X% = &HFFFF0000FFFF0044
Y% = &H800FFFFFFFFFFFFF
X% = X% AND Y%
PRINT HEX$(X%, 16)
Will display "800F0000FFFF0044

SHIFT OPERATORS
These operate in a special way. << means that the value returned
will be the value of x shifted by y bits to the left while >> means the
same only right shifted. They are integer functions and any bits
shifted off are discarded and any bits introduced are set to zero.

Edited 2023-12-09 16:39 by disco4now