[fpc-pascal] OpenCL, Re: C Hex Float.

Marco van de Voort marcov at stack.nl
Tue Apr 28 21:08:43 CEST 2009

In our previous episode, dmitry boyarintsev said:
> Anyway. does FPC community need converted OpenCL headers? i'd like to
> share them.

I'm working in vision, and I'd be very interested in OpenCL headers. 

> Should they be converted to the proper structure first (/src, make,
> fpmake)? there're only 2 files anyway.

Don't worry. I'll do the packaging if needed. I prefer to have a bunch of
examples that test them though.

> I still have not found any reasonable way to convet c-hex-float number
> to pascal.

I think this way is done to make the floating point constants portable.
Maybe it works if you hand shift it, something like

> i'm not sure if it's nice (and cross-platform) to declare, something like
> this:
> const
>   CL_FLT_MAX : double = double($FFFFFFFF);

No it is not :) See also e.g. unit "typ" in unit numlib for ways to do it
CPU specific.

I tried to test with calculation, but it seems fpc/Delphi don't support that
(something like:

const x =  -double($9abc) shl $12;  // sign (mantisse) SHL exponent


More information about the fpc-pascal mailing list