@ -71,27 +71,31 @@ GPB_INLINE void GPBDebugCheckRuntimeVersion() {
// Conversion functions for de/serializing floating point types.
// Conversion functions for de/serializing floating point types.
GPB_INLINE int64_t GPBConvertDoubleToInt64 ( double v ) {
GPB_INLINE int64_t GPBConvertDoubleToInt64 ( double v ) {
union { double f ; int64_t i ; } u ;
GPBInternalCompileAssert ( sizeof ( double ) = = sizeof ( int64_t ) , double_not_64_bits ) ;
u . f = v ;
int64_t result ;
return u . i ;
memcpy ( & result , & v , sizeof ( result ) ) ;
return result ;
}
}
GPB_INLINE int32_t GPBConvertFloatToInt32 ( float v ) {
GPB_INLINE int32_t GPBConvertFloatToInt32 ( float v ) {
union { float f ; int32_t i ; } u ;
GPBInternalCompileAssert ( sizeof ( float ) = = sizeof ( int32_t ) , float_not_32_bits ) ;
u . f = v ;
int32_t result ;
return u . i ;
memcpy ( & result , & v , sizeof ( result ) ) ;
return result ;
}
}
GPB_INLINE double GPBConvertInt64ToDouble ( int64_t v ) {
GPB_INLINE double GPBConvertInt64ToDouble ( int64_t v ) {
union { double f ; int64_t i ; } u ;
GPBInternalCompileAssert ( sizeof ( double ) = = sizeof ( int64_t ) , double_not_64_bits ) ;
u . i = v ;
double result ;
return u . f ;
memcpy ( & result , & v , sizeof ( result ) ) ;
return result ;
}
}
GPB_INLINE float GPBConvertInt32ToFloat ( int32_t v ) {
GPB_INLINE float GPBConvertInt32ToFloat ( int32_t v ) {
union { float f ; int32_t i ; } u ;
GPBInternalCompileAssert ( sizeof ( float ) = = sizeof ( int32_t ) , float_not_32_bits ) ;
u . i = v ;
float result ;
return u . f ;
memcpy ( & result , & v , sizeof ( result ) ) ;
return result ;
}
}
GPB_INLINE int32_t GPBLogicalRightShift32 ( int32_t value , int32_t spaces ) {
GPB_INLINE int32_t GPBLogicalRightShift32 ( int32_t value , int32_t spaces ) {