BitConverter DoubleToInt64Bits and Int64BitsToDouble ?

  • Thread starter Thread starter Carl Rosenberger
  • Start date Start date
C

Carl Rosenberger

Hi all,

I need the above two methods to convert double to long and back
on the CompactFramework, preferrably with good performance.

I really like the idea of using a StructLayout with two members
at the same position that I found here:


Apparently the FieldOffset attribute does not seem to be available
on CF. I find that quite strange, since the documentation states
that LayoutKind.Explicit is supported.

Any ideas, options, hints?


Fast bitshifting code to convert a double to long and back would
be a great help also.

Thanks in advance.


Kind regards,
Carl
 
Carl said:
Fast bitshifting code to convert a double to long and back would
be a great help also.

I solved this problem for myself:

For the moment I can live with BitConverter.GetBytes and
the BitConverter.To[xxx] routines.

They might not be the fastest solution but "optimise late"
usually spares a lot of work.

I still would be grateful for faster solutions.

Thanks.

Kind regards,
Carl
 
Back
Top