Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread gabor via fpc-pascal
W dniu 2022-02-21 o 13:34, gabor via fpc-pascal pisze: W dniu 2022-02-21 o 13:18, Ryan Joseph via fpc-pascal pisze: Oh my, I was confusing my terms I think. I wanted to do bit masking (I think it's called). I was expecting there to be something like TestFlag in the RTL since I can never rememb

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Mattias Gaertner via fpc-pascal
On Mon, 21 Feb 2022 13:34:29 +0100 gabor via fpc-pascal wrote: > W dniu 2022-02-21 o 13:18, Ryan Joseph via fpc-pascal pisze: > > Oh my, I was confusing my terms I think. I wanted to do bit masking > > (I think it's called). I was expecting there to be something like > > TestFlag in the RTL since

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
> On Feb 21, 2022, at 7:31 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Hm. I'm not sure that this code does what you need. > > But masking is indeed not in the helpers. > Try it yourself, it does indeed work. How else are you supposed to test these kinds of bit flag APIs where all

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread gabor via fpc-pascal
W dniu 2022-02-21 o 13:18, Ryan Joseph via fpc-pascal pisze: Oh my, I was confusing my terms I think. I wanted to do bit masking (I think it's called). I was expecting there to be something like TestFlag in the RTL since I can never remember the syntax "Value = (Value or Index)" function Tes

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Michael Van Canneyt via fpc-pascal
On Mon, 21 Feb 2022, Ryan Joseph via fpc-pascal wrote: On Feb 21, 2022, at 7:01 PM, Michael Van Canneyt via fpc-pascal wrote: Yes, this is testbit. Why do you say it does not work ? Oh my, I was confusing my terms I think. I wanted to do bit masking (I think it's called). I was expec

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
> On Feb 21, 2022, at 7:01 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Yes, this is testbit. > > Why do you say it does not work ? Oh my, I was confusing my terms I think. I wanted to do bit masking (I think it's called). I was expecting there to be something like TestFlag in the RT

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Michael Van Canneyt via fpc-pascal
On Mon, 21 Feb 2022, Ryan Joseph via fpc-pascal wrote: I tried to use the bit helpers like https://www.freepascal.org/docs-html/rtl/sysutils/twordhelper.testbit.html but the bit to test is 0..15. There are only 16 bits in a word, so that is correct. I expected this to work like https://wi

[fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
I tried to use the bit helpers like https://www.freepascal.org/docs-html/rtl/sysutils/twordhelper.testbit.html but the bit to test is 0..15. I expected this to work like https://wiki.freepascal.org/Bit_manipulation but that doesn't seem to be the case. Does there exist bit helpers like GetBi