#include "dcltng.h" float lt_sw2c ( int endianness, unsigned char *bullx, int *ibxptr ) /************************************************************************ * lt_sw2c * * * * This routine unpacks a signed integer from the next 4 bytes of a * * lightning report, where negative values are assumed to be * * represented using the two's complement scheme. * * * * Input parameters: * * ENDIANNESS INT Byte-ordering scheme within bulletin: * * 0 = big-endian * * 1 = little-endian * * BULLX CHAR* Lightning bulletin * * IBXPTR INT* Pointer within BULLX * * * * Output parameters: * * IBXPTR INT* Updated pointer within BULLX * * LT_SW2C FLOAT Unpacked value * ** * * Log: * * J. Ator/NCEP 05/15 * ***********************************************************************/ #define POW2_32 ( 4294967296 ) /* = 2 to the 32nd power */ #define POW2_31 ( 2147483648 ) /* = 2 to the 31st power */ { unsigned int ui; long lint; float result; ui = lt_word( endianness, bullx, ibxptr ); if ( ui < POW2_31 ) { result = (float) ui; } else { lint = ( long ) ui; lint = lint - POW2_32; result = (float) lint; } return result; }