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

2009-04-28 Thread dmitry boyarintsev
Anyway. does FPC community need converted OpenCL headers? i'd like to
share them.
Should they be converted to the proper structure first (/src, make,
fpmake)? there're only 2 files anyway.

I still have not found any reasonable way to convet c-hex-float number
to pascal.
i'm not sure if it's nice (and cross-platform) to declare, something like this:

const
  CL_FLT_MAX : double = double($);

thanks,
dmitry

 Does anyone have an experience with converting hex-float numbers from
 C to Pascal?

  CL_FLT_MAX          0x1.fep127f
  CL_FLT_MIN          0x1.0p-126f
  CL_FLT_EPSILON      0x1.0p-23f
  CL_DBL_MAX          0x1.fp1023
  CL_DBL_MIN          0x1.0p-1022
  CL_DBL_EPSILON      0x1.0p-52

 any suggestions?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-04-28 Thread Marco van de Voort
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($);

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

)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-04-28 Thread dmitry boyarintsev
thanks for the reply Marco

 I'm working in vision, and I'd be very interested in OpenCL headers.
you can download converted headers from here:
http://wnsoft.com/~dima/opencl.zip

original c headers are available here:
http://www.khronos.org/registry/cl/

cl.h and cl_platform.h is united into cl.pas file
cl_gl.h is converted to cl_gl.pas.

I did not tested anything, yet. Just made a straight c to pascal
convertion. But, in theory, this should be enough.

thanks,
dmitry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal