Hello.
I've neglected the QL for too many years, and now I'm lost. (Also, I'm old and don't speak English very well: a very bad combo).
Enter 'The Question': I remember that in SuperBasic exists bitwise operators: && (AND) ^^ (XOR) and || (OR). But there is, in SuperBasic, the equivalent bitwise operator for NOT (~~)?
If I try
PRINT ~~value1 (edited, this is the correct form - in C - for bitwise not)
the result is a parser error (bad line).
Bitwise NOT can be implemented via SuperBasic extension, obviously. But I try to not reinvent the wheel.
Someone can help? Thanks in advance.
Emiliano (a.k.a. Flinx)
bitwise operators
Re: bitwise operators
You were close:
NOT is the "logical" NOT operator
~ (single tilde) is the "binary" NOT operator (according to the QPC concepts guide, and that is wrong)
~~ is the right one....
Tobias
NOT is the "logical" NOT operator
~ (single tilde) is the "binary" NOT operator (according to the QPC concepts guide, and that is wrong)
~~ is the right one....
Tobias
Last edited by tofro on Mon Apr 11, 2016 10:42 pm, edited 1 time in total.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: bitwise operators
Hi Emiliano,
just tested on my JS ROM. Tried this: and got the answer -13
So, the classic non-helpful "works on my machine" answer....
Best regards,
Petri
just tested on my JS ROM. Tried this:
Code: Select all
PRINT ~~12
So, the classic non-helpful "works on my machine" answer....

Best regards,
Petri
Re: bitwise operators
Apparently, bitwise operators work on integer variables only in the original QDOS.
SMSQ/E accepts floating point numbers (and converts them to 32-bit longs before applying the operator)
So working/non working can very well depend on the value you tried.
Tobias
SMSQ/E accepts floating point numbers (and converts them to 32-bit longs before applying the operator)
So working/non working can very well depend on the value you tried.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: bitwise operators
Many thanks to you all. The error was mine, and very stupid: I use Q-emulator, and to input the tilde char I was typing ALT+5 combination . I don't know why, but that does not work. If I copy the tilde from PETRI example: voilà, it works.
Ok, time to resume my old QL ...
Again, thanks to all.
Emiliano
Ok, time to resume my old QL ...

Again, thanks to all.
Emiliano
I'm an old boy from Italy. Please be kind with my spelling 
