On 12-4-2013 12:01, Ludo Brands wrote: > On 04/12/2013 11:47 AM, Reinier Olislagers wrote: >> if (FNullField <> nil) and (Dst = nil) and (AFieldDef.NullPosition >= >> 0) then >> begin >> Src := PChar(Src) + FNullField.Offset + (AFieldDef.NullPosition shr 3); >> Result := (PByte(Src)^ and (1 shl (AFieldDef.NullPosition and $7))) = 0; >> exit; >> end; >> > > NullPosition is a bit position, 8 bits in a byte. To find bit x you have > to look in byte Start + x div 8. x div 8 can be written as x shr 3. Now > that you have found the byte where bit x is you need to isolate that > bit. Its position in the byte is X mod 8 which you can write as X and > $7. The 1 shl (X and $7) is done to create a mask to get the correct bit. > > Ludo
Thanks Marco & Ludo, The penny finally dropped. Regards, Reinier _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal