[fpc-pascal] Why does this work?

2013-04-12 Thread Reinier Olislagers
As a certified high-level coder with a fear for anything that smells like pointers and bits I hesitated to post this as the answer may well be: figure it out yourself, it's obvious ;)... but at least it's worth a laugh to you bitpushers out there. Have mercy ;) Going through the dbase code, I hit

Re: [fpc-pascal] Why does this work?

2013-04-12 Thread Marco van de Voort
In our previous episode, Reinier Olislagers said: > multiple bytes (apparently stored BE: the first field goes into the > lower byte, the 8th field in the next byte). > > > I have a lot of trouble with shr and shl going on. The first line > seemingly drops the three lower bits... but why? > ... a

Re: [fpc-pascal] Why does this work?

2013-04-12 Thread Ludo Brands
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