23
23
/* these two are for uniformity */
24
#define mi_sint1korr(A) ((int8)(*A))
25
#define mi_uint1korr(A) ((uint8)(*A))
24
#define mi_sint1korr(A) ((int8_t)(*A))
25
#define mi_uint1korr(A) ((uint8_t)(*A))
27
#define mi_sint2korr(A) ((int16) (((int16) (((uchar*) (A))[1])) +\
28
((int16) ((int16) ((char*) (A))[0]) << 8)))
29
#define mi_sint3korr(A) ((int32) (((((uchar*) (A))[0]) & 128) ? \
30
(((uint32) 255L << 24) | \
31
(((uint32) ((uchar*) (A))[0]) << 16) |\
32
(((uint32) ((uchar*) (A))[1]) << 8) | \
33
((uint32) ((uchar*) (A))[2])) : \
34
(((uint32) ((uchar*) (A))[0]) << 16) |\
35
(((uint32) ((uchar*) (A))[1]) << 8) | \
36
((uint32) ((uchar*) (A))[2])))
37
#define mi_sint4korr(A) ((int32) (((int32) (((uchar*) (A))[3])) +\
38
((int32) (((uchar*) (A))[2]) << 8) +\
39
((int32) (((uchar*) (A))[1]) << 16) +\
40
((int32) ((int16) ((char*) (A))[0]) << 24)))
27
#define mi_sint2korr(A) ((int16_t) (((int16_t) (((uchar*) (A))[1])) +\
28
((int16_t) ((int16_t) ((char*) (A))[0]) << 8)))
29
#define mi_sint3korr(A) ((int32_t) (((((uchar*) (A))[0]) & 128) ? \
30
(((uint32_t) 255L << 24) | \
31
(((uint32_t) ((uchar*) (A))[0]) << 16) |\
32
(((uint32_t) ((uchar*) (A))[1]) << 8) | \
33
((uint32_t) ((uchar*) (A))[2])) : \
34
(((uint32_t) ((uchar*) (A))[0]) << 16) |\
35
(((uint32_t) ((uchar*) (A))[1]) << 8) | \
36
((uint32_t) ((uchar*) (A))[2])))
37
#define mi_sint4korr(A) ((int32_t) (((int32_t) (((uchar*) (A))[3])) +\
38
((int32_t) (((uchar*) (A))[2]) << 8) +\
39
((int32_t) (((uchar*) (A))[1]) << 16) +\
40
((int32_t) ((int16_t) ((char*) (A))[0]) << 24)))
41
41
#define mi_sint8korr(A) ((int64_t) mi_uint8korr(A))
42
#define mi_uint2korr(A) ((uint16) (((uint16) (((uchar*) (A))[1])) +\
43
((uint16) (((uchar*) (A))[0]) << 8)))
44
#define mi_uint3korr(A) ((uint32) (((uint32) (((uchar*) (A))[2])) +\
45
(((uint32) (((uchar*) (A))[1])) << 8) +\
46
(((uint32) (((uchar*) (A))[0])) << 16)))
47
#define mi_uint4korr(A) ((uint32) (((uint32) (((uchar*) (A))[3])) +\
48
(((uint32) (((uchar*) (A))[2])) << 8) +\
49
(((uint32) (((uchar*) (A))[1])) << 16) +\
50
(((uint32) (((uchar*) (A))[0])) << 24)))
51
#define mi_uint5korr(A) ((uint64_t)(((uint32) (((uchar*) (A))[4])) +\
52
(((uint32) (((uchar*) (A))[3])) << 8) +\
53
(((uint32) (((uchar*) (A))[2])) << 16) +\
54
(((uint32) (((uchar*) (A))[1])) << 24)) +\
42
#define mi_uint2korr(A) ((uint16_t) (((uint16_t) (((uchar*) (A))[1])) +\
43
((uint16_t) (((uchar*) (A))[0]) << 8)))
44
#define mi_uint3korr(A) ((uint32_t) (((uint32_t) (((uchar*) (A))[2])) +\
45
(((uint32_t) (((uchar*) (A))[1])) << 8) +\
46
(((uint32_t) (((uchar*) (A))[0])) << 16)))
47
#define mi_uint4korr(A) ((uint32_t) (((uint32_t) (((uchar*) (A))[3])) +\
48
(((uint32_t) (((uchar*) (A))[2])) << 8) +\
49
(((uint32_t) (((uchar*) (A))[1])) << 16) +\
50
(((uint32_t) (((uchar*) (A))[0])) << 24)))
51
#define mi_uint5korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[4])) +\
52
(((uint32_t) (((uchar*) (A))[3])) << 8) +\
53
(((uint32_t) (((uchar*) (A))[2])) << 16) +\
54
(((uint32_t) (((uchar*) (A))[1])) << 24)) +\
55
55
(((uint64_t) (((uchar*) (A))[0])) << 32))
56
#define mi_uint6korr(A) ((uint64_t)(((uint32) (((uchar*) (A))[5])) +\
57
(((uint32) (((uchar*) (A))[4])) << 8) +\
58
(((uint32) (((uchar*) (A))[3])) << 16) +\
59
(((uint32) (((uchar*) (A))[2])) << 24)) +\
60
(((uint64_t) (((uint32) (((uchar*) (A))[1])) +\
61
(((uint32) (((uchar*) (A))[0]) << 8)))) <<\
63
#define mi_uint7korr(A) ((uint64_t)(((uint32) (((uchar*) (A))[6])) +\
64
(((uint32) (((uchar*) (A))[5])) << 8) +\
65
(((uint32) (((uchar*) (A))[4])) << 16) +\
66
(((uint32) (((uchar*) (A))[3])) << 24)) +\
67
(((uint64_t) (((uint32) (((uchar*) (A))[2])) +\
68
(((uint32) (((uchar*) (A))[1])) << 8) +\
69
(((uint32) (((uchar*) (A))[0])) << 16))) <<\
71
#define mi_uint8korr(A) ((uint64_t)(((uint32) (((uchar*) (A))[7])) +\
72
(((uint32) (((uchar*) (A))[6])) << 8) +\
73
(((uint32) (((uchar*) (A))[5])) << 16) +\
74
(((uint32) (((uchar*) (A))[4])) << 24)) +\
75
(((uint64_t) (((uint32) (((uchar*) (A))[3])) +\
76
(((uint32) (((uchar*) (A))[2])) << 8) +\
77
(((uint32) (((uchar*) (A))[1])) << 16) +\
78
(((uint32) (((uchar*) (A))[0])) << 24))) <<\
56
#define mi_uint6korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[5])) +\
57
(((uint32_t) (((uchar*) (A))[4])) << 8) +\
58
(((uint32_t) (((uchar*) (A))[3])) << 16) +\
59
(((uint32_t) (((uchar*) (A))[2])) << 24)) +\
60
(((uint64_t) (((uint32_t) (((uchar*) (A))[1])) +\
61
(((uint32_t) (((uchar*) (A))[0]) << 8)))) <<\
63
#define mi_uint7korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[6])) +\
64
(((uint32_t) (((uchar*) (A))[5])) << 8) +\
65
(((uint32_t) (((uchar*) (A))[4])) << 16) +\
66
(((uint32_t) (((uchar*) (A))[3])) << 24)) +\
67
(((uint64_t) (((uint32_t) (((uchar*) (A))[2])) +\
68
(((uint32_t) (((uchar*) (A))[1])) << 8) +\
69
(((uint32_t) (((uchar*) (A))[0])) << 16))) <<\
71
#define mi_uint8korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[7])) +\
72
(((uint32_t) (((uchar*) (A))[6])) << 8) +\
73
(((uint32_t) (((uchar*) (A))[5])) << 16) +\
74
(((uint32_t) (((uchar*) (A))[4])) << 24)) +\
75
(((uint64_t) (((uint32_t) (((uchar*) (A))[3])) +\
76
(((uint32_t) (((uchar*) (A))[2])) << 8) +\
77
(((uint32_t) (((uchar*) (A))[1])) << 16) +\
78
(((uint32_t) (((uchar*) (A))[0])) << 24))) <<\
81
81
/* This one is for uniformity */