I reported one case already.
https://bugs.freepascal.org/view.php?id=35598
Compiling 42090 for win32 with the options
-gl -O4 -Or
fails with the warning/error: defutil.pas(1606,7) Warning: Function
result variable does not seem to initialized
Just run into the next error. Compiling with -gl
On 17.05.2019 10:47, Marco Borsari via fpc-devel wrote:
Does this is an effect of some multiplication overflow, or is it a bug?
Both the bit operations and the arithmetic opretaions return integers as
results and not words:
https://www.freepascal.org/docs-html/ref/refsu46.html
On Fri, 17 May 2019 16:45:52 +0200
gabor wrote:
> Can you provide c source code?
> I'm not sure about this:
> ...(a SHL 5+b SHR 2)...
> Maybe it should look like this:
> ((a SHL 5+b) SHR 2)
>
> Regards, Michał.
Please look at
https://burtleburtle.net/bob/hash/doobs.html
for the Rotating
Never mind, I thought that comes to code in C language but it's about
variable named "c".
W dniu 2019-05-17 o 16:45, gabor pisze:
Can you provide c source code?
Regards, Michał.
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
Can you provide c source code?
I'm not sure about this:
...(a SHL 5+b SHR 2)...
Maybe it should look like this:
((a SHL 5+b) SHR 2)
Regards, Michał.
W dniu 2019-05-17 o 10:47, Marco Borsari via fpc-devel pisze:
In the code below
program test;
const n=12;
s=1 shl n;
var a,b,c,h1,h2:word;
On 5/17/19 9:44 AM, J. Gareth Moreton wrote:
It's a constant set to equal 2^n, or in binary, 1 followed by n zeroes.
ugh! yeah, i see that now... the layout confused me as i'm used to CONST being
on its own line or prefixed to every constant defined...
eg:
const
n=12;
s=1 shl n;
OR
It's a constant set to equal 2^n, or in binary, 1 followed by n zeroes.
Gareth aka. Kit
P.S. And yes, that mask is also zero-extended to 32-bit or whatever the
word size is on the CPU.
On 17/05/2019 14:24, wkitt...@windstream.net wrote:
On 5/17/19 4:47 AM, Marco Borsari via fpc-devel
On 5/17/19 4:47 AM, Marco Borsari via fpc-devel wrote:
In the code below
program test;
const n=12;
s=1 shl n;
var a,b,c,h1,h2:word;
ummm... what is 's'? you've used it before it has been defined...
begin
a:=77;
b:=0;
(*c:=(a XOR b)*(a SHL 5+b SHR 2);*)
h1:=((a XOR b)*(a SHL 5+b SHR 2))
On Fri, 17 May 2019 14:36:52 +0200
Marco Borsari via fpc-devel wrote:
> Thank you, your answer make it clear the nature of the problem, i.e.
> operation size extension.
> Anyway, if I understand correct, the masking as reported in the code
> does not operate over the 16 bit limit, so even h2
On Fri, 17 May 2019 11:55:55 +0100
"J. Gareth Moreton" wrote:
> On a slightly different note, I would be careful about only using a
> 16-bit hash, because the chance of a collision is only about 1 in 320
> (see "Birthday attack")
>
> Gareth aka. Kit
Thank you, but in my use case collisions
On Fri, 17 May 2019 11:51:20 +0100
"J. Gareth Moreton" wrote:
> One thing to be aware of is that the compiler will extend intermediate
> expressions to the CPU size, so if the multiplication overflows into 32
> bits in h1 (which it does for the given values of a and b), it will
> preserve
On a slightly different note, I would be careful about only using a
16-bit hash, because the chance of a collision is only about 1 in 320
(see "Birthday attack")
Gareth aka. Kit
On 17/05/2019 11:51, J. Gareth Moreton wrote:
One thing to be aware of is that the compiler will extend
One thing to be aware of is that the compiler will extend intermediate
expressions to the CPU size, so if the multiplication overflows into 32
bits in h1 (which it does for the given values of a and b), it will
preserve those bits and will end up shifting them to the right instead
of zeroes.
In the code below
program test;
const n=12;
s=1 shl n;
var a,b,c,h1,h2:word;
begin
a:=77;
b:=0;
(*c:=(a XOR b)*(a SHL 5+b SHR 2);*)
h1:=((a XOR b)*(a SHL 5+b SHR 2)) SHR (16-n);
(*h1:=c SHR (16-n);*)
h2:=((a XOR b)*(a SHL 5+b SHR 2)) AND ((s-1) SHL (16-n)) SHR (16-n);
(*h2:=c AND ((s-1) SHL
14 matches
Mail list logo