lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 25 Nov 2011 17:46:48 +0000
From:	Nuno Santos <nsantos@...gma.com>
To:	Paulo Marques <pmarques@...popie.com>
CC:	Jiri Slaby <jirislaby@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: Floating point usage inside kernel

>
> Given the range of numbers you're working with, you can probably get
> away with just a 16.16 fixed point representation. The operations go
> like this:
>
> convert a double to a fixed point number just do (but not on the kernel):
>
>    fixed = (s32)(double * 65536.0);
>
> convert an integer to fixed:
>
>    fixed = integer<<  16;
>
> multiplication:
>
>    result = (s32)(((s64) fixed_a * fixed_b)>>  16);
>
> addition:
>
>    result = fixed_a + fixed_b;
>
> etc...
>
> Unless you have overflow or need more than 16 bits of fractional
> precision, you'll have no problem with this approach.
>
> I hope this helps,
Sorry, i'm not sure if I have completely understand your suggestion. Are 
you telling me to apply this transform only to my input data, or to all 
the operations that are applied in the function used in kernel?

Thanks,

With my best regards,

Nuno
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ