PC Review


Reply
Thread Tools Rate Thread

BitConverter DoubleToInt64Bits and Int64BitsToDouble ?

 
 
Carl Rosenberger
Guest
Posts: n/a
 
      3rd Sep 2003
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:

> http://groups.google.com/groups?(E-Mail Removed)%3E



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 Rosenberger
db4o - database for objects - http://www.db4o.com


 
Reply With Quote
 
 
 
 
Carl Rosenberger
Guest
Posts: n/a
 
      3rd Sep 2003
Carl Rosenberger wrote:
> 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
--
Carl Rosenberger
db4o - database for objects - http://www.db4o.com


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do BitConverter.SingleToInt32Bits() Tom Jastrzebski Microsoft C# .NET 1 17th Aug 2005 07:12 AM
BitConverter question Timothy V Microsoft C# .NET 2 10th Nov 2004 02:53 PM
Re: BitConverter.DoubleToInt64Bits Jon Skeet [C# MVP] Microsoft Dot NET 0 28th Jul 2004 08:09 AM
BitConverter.ToString() bug Opa1 Microsoft C# .NET 2 29th Apr 2004 12:19 AM
BitConverter and back again? Gabe Jahn Microsoft C# .NET 1 25th Jul 2003 10:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 AM.