[fpc-devel] Question about Word128

Kirinn kirinn at mooncore.eu
Tue Aug 7 23:06:28 CEST 2018


To be clear, 128-bit octawords and the like are not natively supported 
on most consumer-oriented processors. To support 128-bit operations, an 
extensive emulation layer would need to be set up, not an easy task 
within the scope of a compiler and the RTL.

If you need 128-bit integer maths in the near future, your best bet 
would be to write a quick and dirty implementation yourself with records 
and operator overloading, as Sven described. Has anyone done that yet? 
It might make an interesting unit for the Free Component Library or 
something.

I note that SysUtils includes an "Int128Rec", which is a record type for 
holding a 128-bit int. Looks like it's currently used only by 
InterlockedCompareExchange128. Someone brave could expand upon that.

~Kirinn


On 08/07/2018 03:11 PM, J. Gareth Moreton wrote:
> I think there was talk at one point about implementing Float128 (or 
> "Quadruple") for Free Pascal, mostly for internal compiler purposes.  
> For OWords though (or is it EWords or DQWords?) I think a library or 
> package will be better initially.  Still, it might be something to 
> consider if Intel or another processor manufacturer introduce 128-bit 
> number functions for XMM registers and equivalent.
>
> Gareth aka. Kit
>
>
> On Tue 07/08/18 10:09 , Sven Barth via fpc-devel 
> fpc-devel at lists.freepascal.org sent:
>
>     Aelita <aelita-x at narod.ru <mailto:aelita-x at narod.ru>> schrieb am
>     Di., 7. Aug. 2018, 09:53:
>
>         Hello!
>
>         My name is Aelita and for many years I have been fruitfully
>         using your wonderful freepascal
>         for my research in algebra, geometry and physics.
>         Thank you for your inspirational work!
>
>         I'm very interested in seeing the numbers Word128 and Int128
>         appear in freepascal
>         (with natural operations A*B, A div B, A mod B, A xor B, A shl
>         N, etc.)!
>
>         Is there a chance that this will happen in the near future?
>
>
>     Using records and operator overloading you can implement them
>     yourself. No need to burden the compiler with it. The only
>     disadvantage would be the inability to use that large literals...
>     but that could be helped a bit with conversions from floating
>     points,at least if full accuracy isn't required.
>
>     Regards,
>     Sven
>
>     _______________________________________________
>     fpc-devel maillist - fpc-devel at lists.freepascal.org
>     <mailto:fpc-devel at lists.freepascal.org>
>     http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>     <%3Ca%20href=>">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180807/4c32938f/attachment.html>


More information about the fpc-devel mailing list