*refactored _set_real_with_hex
to avoid c4310
(vc).
This commit is contained in:
parent
34de08a805
commit
5bd179b199
@ -945,20 +945,25 @@ static _object_t* _exp_assign = 0;
|
|||||||
#define _set_real_with_hex(__r, __i) \
|
#define _set_real_with_hex(__r, __i) \
|
||||||
do { \
|
do { \
|
||||||
if(sizeof(__r) == sizeof(unsigned char)) { \
|
if(sizeof(__r) == sizeof(unsigned char)) { \
|
||||||
unsigned char __b = (unsigned char)__i; \
|
union { unsigned char i; real_t r; } __u; \
|
||||||
memcpy(&(__r), &__b, sizeof(__r)); \
|
__u.i = __i; \
|
||||||
|
__r = __u.r; \
|
||||||
} else if(sizeof(__r) == sizeof(unsigned short)) { \
|
} else if(sizeof(__r) == sizeof(unsigned short)) { \
|
||||||
unsigned short __b = (unsigned short)__i; \
|
union { unsigned short i; real_t r; } __u; \
|
||||||
memcpy(&(__r), &__b, sizeof(__r)); \
|
__u.i = __i; \
|
||||||
|
__r = __u.r; \
|
||||||
} else if(sizeof(__r) == sizeof(unsigned)) { \
|
} else if(sizeof(__r) == sizeof(unsigned)) { \
|
||||||
unsigned __b = (unsigned)__i; \
|
union { unsigned i; real_t r; } __u; \
|
||||||
memcpy(&(__r), &__b, sizeof(__r)); \
|
__u.i = __i; \
|
||||||
|
__r = __u.r; \
|
||||||
} else if(sizeof(__r) == sizeof(unsigned long)) { \
|
} else if(sizeof(__r) == sizeof(unsigned long)) { \
|
||||||
unsigned long __b = (unsigned long)__i; \
|
union { unsigned long i; real_t r; } __u; \
|
||||||
memcpy(&(__r), &__b, sizeof(__r)); \
|
__u.i = __i; \
|
||||||
|
__r = __u.r; \
|
||||||
} else if(sizeof(__r) == sizeof(unsigned long long)) { \
|
} else if(sizeof(__r) == sizeof(unsigned long long)) { \
|
||||||
unsigned long long __b = (unsigned long long)__i; \
|
union { unsigned long long i; real_t r; } __u; \
|
||||||
memcpy(&(__r), &__b, sizeof(__r)); \
|
__u.i = __i; \
|
||||||
|
__r = __u.r; \
|
||||||
} else { \
|
} else { \
|
||||||
mb_assert(0 && "Invalid real number precision."); \
|
mb_assert(0 && "Invalid real number precision."); \
|
||||||
} \
|
} \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user