z := x AND y is a bitwise AND

(not (foldhiddenmask or currentfoldhiddenmask))

results in

dec: -193    hex: ffff ff3f     bin: 1111 1111 1111 1111 1111 1111 0011 1111

this AND hex: $ff (bin: 11111 1111) gives

bin: 1111 1111 1111 1111 1111 1111 0011 1111
AND
bin: 0000 0000 0000 0000 0000 0000 1111 1111
--------------------------------------------------------------------
bin: 0000 0000 0000 0000 0000 0000 0011 1111

the result now definitely fits in a byte

The operators NOT, AND, OR, XOR (applied to integers) should be mentioned somewhere in the documentation, maybe the explanation there is clearer


----- Original Message ----- From: "fredvs via fpc-pascal" <fpc-pascal@lists.freepascal.org>
To: <fpc-pascal@lists.freepascal.org>
Cc: "fredvs" <fi...@hotmail.com>
Sent: Tuesday, March 24, 2020 8:59 PM
Subject: Re: [fpc-pascal] Range check error warning.


what about

foldlevelmask = (not (foldhiddenmask or currentfoldhiddenmask)) and $ff ;

Ha, this one fpc 3.3.1 like it!

No more warning nor error.

May I ask you what "and $ff" does, is it the same as "abs()" or keep it the
negative value?

Many thanks.

Fre;D



-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to