mk-soft wrote: Sun Apr 16, 2023 10:07 pm
However, I prefer the type unsigned char for C-backend as in my example, because PB internally converts everything back to quad before shifting bits.
No any theoretically possible fix for that with 1-byte? Like this I tried with masking:
idle wrote: Mon Apr 17, 2023 4:38 am
Do you understand it looking at the assembly?
Yes, at least see key ops, even though I don't want to go to ASM now and didn't looked at that <<4 also. Just curious as I said, asked without doing anything myself until really will need that, as soon at there are talks around that.
This thread should be moved to general discussions I think.
For me as it works and produces correct and predictable results (16-32-64), it's still good and usable variant, maybe even more goes to "tricks".
The other about 8 more a discussion.
In Purebasic, all comparison, shift and math of byte, word, longs, integers, quads are processed signed.
With the introduction of Unicode, the vartype var.a (ascii) was added as an unsigned byte and the vartype var.u (unicode) as an unsigned word.
I hope you know how negative integers are represented and what happens when bits are shifted to avoid losing the sign.
Only with the use of the correct vartype it also works optimised.
There are already many examples from us ...
mk-soft wrote: Mon Apr 17, 2023 1:12 pm
You're making it too complicated for yourself.
In Purebasic, all comparison, shift and math of byte, word, longs, integers, quads are processed signed.
With the introduction of Unicode, the vartype var.a (ascii) was added as an unsigned byte and the vartype var.u (unicode) as an unsigned word.
I hope you know how negative integers are represented and what happens when bits are shifted to avoid losing the sign.
Only with the use of the correct vartype it also works optimised.
There are already many examples from us ...
Well I'd send you a silent "like" for your replies if this forum had them, but it doesn't so there is textural.
> I hope you know how negative integers are represented and what happens when bits are shifted to avoid losing the sign.
Remembering that single bit.