/// <summary> /// Store a 32-bit float into the specified byte array. /// </summary> /// <param name="buffer">The buffer to store the float which must have a size of 4 or greated</param> /// <param name="value">The float value to store</param> public static void GetBytes(byte[] buffer, float value) { unchecked { // Convert the float to a common 32 bit value int intValue = Common32.ToInteger(value); // Call through GetBytes(buffer, intValue); } }
/// <summary> /// Retreive a 32-bit float from the specified byte array. /// </summary> /// <param name="buffer">The buffer to retreive the float from which must have a size of 4 or greater</param> /// <returns>The unpacked float value</returns> public static float GetFloat(byte[] buffer) { unchecked { // Call through to read a 32 bit value int value = GetInt(buffer); // Convert to commmon value return(Common32.ToSingle(value)); } }