Convert double from Small Endian to Big Endian and vice versa

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 3
Reputation: sidharthrshah is an unknown quantity at this point 
Solved Threads: 0
sidharthrshah sidharthrshah is offline Offline
Newbie Poster

Convert double from Small Endian to Big Endian and vice versa

 
0
  #1
May 13th, 2008
How do I convert double datatype from small endian to big endian and vice versa in c#. Your help will be highly appreciated.

Regards,
Sidharth Shah
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 1
Reputation: robertwharvey is an unknown quantity at this point 
Solved Threads: 0
robertwharvey robertwharvey is offline Offline
Newbie Poster

Re: Convert double from Small Endian to Big Endian and vice versa

 
0
  #2
Jun 10th, 2008
  1. public static byte[] GetBigEndianBytesFromDouble(double value)
  2. {
  3. byte[] b;
  4. b=BitConverter.GetBytes(value);
  5. if (BitConverter.IsLittleEndian)
  6. Array.Reverse(b);
  7. return b;
  8. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC