Re: [fpc-pascal] Pointer hashing

2017-01-31 Thread Mark Morgan Lloyd
On 31/01/17 15:30, Ryan Joseph wrote: Thanks for answering guys. Yes José is right, hashing the pointer wasn’t even a good solution so I used another hash. I had the pointers stored in another data type and I wanted to quickly test for the their entry in the table but I found another way. On

Re: [fpc-pascal] Pointer hashing

2017-01-31 Thread Ryan Joseph
Thanks for answering guys. Yes José is right, hashing the pointer wasn’t even a good solution so I used another hash. I had the pointers stored in another data type and I wanted to quickly test for the their entry in the table but I found another way. > On Jan 30, 2017, at 4:28 PM, José Mejuto

Re: [fpc-pascal] Pointer hashing

2017-01-30 Thread José Mejuto
El 30/01/2017 a las 3:37, Ryan Joseph escribió: I’m trying to hash a pointer value and found some example of hash function but not sure about translations and the process in general. Hello, After addressing the ^ conversion showed by other people I have a question. Why you need to hash a po

Re: [fpc-pascal] Pointer hashing

2017-01-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 30 Jan 2017, Ryan Joseph wrote: > I?m trying to hash a pointer value and found some example of hash > function but not sure about translations and the process in general. > > 1) Should I cast ?pointer? as PtrUInt to get an integer from a pointer? > I?m looking for the memory address I

Re: [fpc-pascal] Pointer hashing

2017-01-29 Thread Marco van de Voort
In our previous episode, Ryan Joseph said: > > unsigned int hash(unsigned int x) { > x = ((x >> 16) ^ x) * 0x45d9f3b; > x = ((x >> 16) ^ x) * 0x45d9f3b; > x = (x >> 16) ^ x; > return x; > } > > function Hash (x: PtrUInt): PtrUInt; > begin > x := (Power((x shr 16), x)) * $45d9f3b

Re: [fpc-pascal] Pointer hashing

2017-01-29 Thread Lars
On Sun, January 29, 2017 7:37 pm, Ryan Joseph wrote: > I'm trying to hash a pointer value and found some example of hash > function but not sure about translations and the process in general. ... > x := (Power((x shr 16), x)) * $45d9f3b; x := Power((x shr 16), x); result := The math unit, is som

[fpc-pascal] Pointer hashing

2017-01-29 Thread Ryan Joseph
I’m trying to hash a pointer value and found some example of hash function but not sure about translations and the process in general. 1) Should I cast “pointer” as PtrUInt to get an integer from a pointer? I’m looking for the memory address I guess and casting seems to return a unique value. B