Y
Yair
Hi,
I need to shift the bits of a float type.
In order to do so, I declared the following struct:
[StructLayout(LayoutKind.Explicit, Size=4)]
private struct unionIntFloatType
{
[FieldOffset(0)]
public float m_asFloat;
[FieldOffset(0)]
public int m_asInt;
}
Problem is: If I initialize the struct via 'm_asFloat',
and then extract the data using 'm_asInt', I get
CS0170: "Use of possibly unassigned field..." (Since
actually m_asInt was not initialized directly).
Writing a dummy 'm_asInt=0' at the begining of the call is
quite costly, since I'm within a loop.
Will appreciate any help with this...
I need to shift the bits of a float type.
In order to do so, I declared the following struct:
[StructLayout(LayoutKind.Explicit, Size=4)]
private struct unionIntFloatType
{
[FieldOffset(0)]
public float m_asFloat;
[FieldOffset(0)]
public int m_asInt;
}
Problem is: If I initialize the struct via 'm_asFloat',
and then extract the data using 'm_asInt', I get
CS0170: "Use of possibly unassigned field..." (Since
actually m_asInt was not initialized directly).
Writing a dummy 'm_asInt=0' at the begining of the call is
quite costly, since I'm within a loop.
Will appreciate any help with this...