Jump to content
  • Advertisement
Sign in to follow this  
DrGUI

[.net] Radix sort on floats in .NET

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Thanks for the reply Shannon!

Is a union a good way to get the bits of a float?

using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
struct IntFloat
{
[FieldOffset(0)]
public int i;
[FieldOffset(0)]
public float f;
}

Apparantly ints and floats are stored in separate parts of the processor so it won't be free, but oh well [smile]

Ooo - I'll look into Marshall too...I think that can do copying across types without using unsafe code. EDIT: marshall not useful for this. I don't want to use unsafe code because I think that means your IL is unverifiable and the OS will consider your app more dangerous.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!