diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/byte_order_generic.h | 53 | ||||
-rw-r--r-- | include/byte_order_generic_x86.h | 23 | ||||
-rw-r--r-- | include/byte_order_generic_x86_64.h | 7 | ||||
-rw-r--r-- | include/myisampack.h | 65 |
4 files changed, 76 insertions, 72 deletions
diff --git a/include/byte_order_generic.h b/include/byte_order_generic.h index 451202be3b6..8381941b9b9 100644 --- a/include/byte_order_generic.h +++ b/include/byte_order_generic.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +18,7 @@ Endianness-independent definitions for architectures other than the x86 architecture. */ -#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\ +#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\ ((int16) ((int16) (A)[1]) << 8)) #define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ (((uint32) 255L << 24) | \ @@ -27,38 +28,38 @@ (((uint32) (uchar) (A)[2]) << 16) |\ (((uint32) (uchar) (A)[1]) << 8) | \ ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\ - (((int32) ((uchar) (A)[1]) << 8)) +\ - (((int32) ((uchar) (A)[2]) << 16)) +\ +#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\ + (((int32) ((uchar) (A)[1]) << 8)) |\ + (((int32) ((uchar) (A)[2]) << 16)) |\ (((int32) ((int16) (A)[3]) << 24))) #define sint8korr(A) (longlong) uint8korr(A) -#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\ +#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\ ((uint16) ((uchar) (A)[1]) << 8)) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ +#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ (((uint32) ((uchar) (A)[3])) << 24)) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ - (((uint32) ((uchar) (A)[1])) << 8) + \ - (((uint32) ((uchar) (A)[2])) << 16) + \ - (((uint32) ((uchar) (A)[3])) << 24)) + \ - (((ulonglong) ((uchar) (A)[4])) << 32) + \ +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ + (((uint32) ((uchar) (A)[1])) << 8) | \ + (((uint32) ((uchar) (A)[2])) << 16) | \ + (((uint32) ((uchar) (A)[3])) << 24)) | \ + (((ulonglong) ((uchar) (A)[4])) << 32) | \ (((ulonglong) ((uchar) (A)[5])) << 40)) -#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) (((uint32) ((uchar) (A)[4])) +\ - (((uint32) ((uchar) (A)[5])) << 8) +\ - (((uint32) ((uchar) (A)[6])) << 16) +\ +#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ + (((ulonglong) (((uint32) ((uchar) (A)[4])) |\ + (((uint32) ((uchar) (A)[5])) << 8) |\ + (((uint32) ((uchar) (A)[6])) << 16) |\ (((uint32) ((uchar) (A)[7])) << 24))) <<\ 32)) #define int2store(T,A) do { uint def_temp= (uint) (A) ;\ diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h index 4b2cbbe5584..72e00be8c2c 100644 --- a/include/byte_order_generic_x86.h +++ b/include/byte_order_generic_x86.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,20 +28,20 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((const long *) (A))) #define uint2korr(A) (*((const uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) #define uint4korr(A) (*((const uint32 *) (A))) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ - (((uint32) ((uchar) (A)[1])) << 8) + \ - (((uint32) ((uchar) (A)[2])) << 16) + \ - (((uint32) ((uchar) (A)[3])) << 24)) + \ - (((ulonglong) ((uchar) (A)[4])) << 32) + \ +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ + (((uint32) ((uchar) (A)[1])) << 8) | \ + (((uint32) ((uchar) (A)[2])) << 16) | \ + (((uint32) ((uchar) (A)[3])) << 24)) | \ + (((ulonglong) ((uchar) (A)[4])) << 32) | \ (((ulonglong) ((uchar) (A)[5])) << 40)) #define uint8korr(A) (*((const ulonglong *) (A))) #define sint8korr(A) (*((const longlong *) (A))) diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h index 68001ca941f..a25e6a2ab08 100644 --- a/include/byte_order_generic_x86_64.h +++ b/include/byte_order_generic_x86_64.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,8 +29,8 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (int32) (*((int32 *) (A))) #define uint2korr(A) (uint16) (*((uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) #define uint4korr(A) (uint32) (*((uint32 *) (A))) @@ -53,7 +54,7 @@ static inline ulonglong uint6korr(const void *p) #define int2store(T,A) do { uchar *pT= (uchar*)(T);\ *((uint16*)(pT))= (uint16) (A);\ } while (0) - + #define int3store(T,A) do { *(T)= (uchar) ((A));\ *(T+1)=(uchar) (((uint) (A) >> 8));\ *(T+2)=(uchar) (((A) >> 16));\ diff --git a/include/myisampack.h b/include/myisampack.h index eb5baf5fc56..6bfe1958fbc 100644 --- a/include/myisampack.h +++ b/include/myisampack.h @@ -2,6 +2,7 @@ #define MYISAMPACK_INCLUDED /* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc. + Copyright (c) 2020, MariaDB Corporation. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -28,7 +29,7 @@ #define mi_sint1korr(A) ((int8)(*A)) #define mi_uint1korr(A) ((uint8)(*A)) -#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\ +#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\ ((int16) ((int16) ((const char*) (A))[0]) << 8))) #define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \ (((uint32) 255L << 24) | \ @@ -38,58 +39,58 @@ (((uint32) ((const uchar*) (A))[0]) << 16) |\ (((uint32) ((const uchar*) (A))[1]) << 8) | \ ((uint32) ((const uchar*) (A))[2]))) -#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\ - ((int32) (((const uchar*) (A))[2]) << 8) +\ - ((int32) (((const uchar*) (A))[1]) << 16) +\ +#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\ + ((int32) (((const uchar*) (A))[2]) << 8) |\ + ((int32) (((const uchar*) (A))[1]) << 16) |\ ((int32) ((int16) ((const char*) (A))[0]) << 24))) #define mi_sint8korr(A) ((longlong) mi_uint8korr(A)) -#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\ +#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\ ((uint16) (((const uchar*) (A))[0]) << 8))) -#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\ - (((uint32) (((const uchar*) (A))[1])) << 8) +\ +#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\ + (((uint32) (((const uchar*) (A))[1])) << 8) |\ (((uint32) (((const uchar*) (A))[0])) << 16))) -#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\ - (((uint32) (((const uchar*) (A))[2])) << 8) +\ - (((uint32) (((const uchar*) (A))[1])) << 16) +\ +#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\ + (((uint32) (((const uchar*) (A))[2])) << 8) |\ + (((uint32) (((const uchar*) (A))[1])) << 16) |\ (((uint32) (((const uchar*) (A))[0])) << 24))) #ifndef HAVE_mi_uint5korr -#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\ - (((uint32) (((const uchar*) (A))[3])) << 8) +\ - (((uint32) (((const uchar*) (A))[2])) << 16) +\ - (((uint32) (((const uchar*) (A))[1])) << 24)) +\ +#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\ + (((uint32) (((const uchar*) (A))[3])) << 8) |\ + (((uint32) (((const uchar*) (A))[2])) << 16) |\ + (((uint32) (((const uchar*) (A))[1])) << 24)) |\ (((ulonglong) (((const uchar*) (A))[0])) << 32)) #endif /* HAVE_mi_uint5korr */ #ifndef HAVE_mi_uint6korr -#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\ - (((uint32) (((const uchar*) (A))[4])) << 8) +\ - (((uint32) (((const uchar*) (A))[3])) << 16) +\ - (((uint32) (((const uchar*) (A))[2])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\ +#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\ + (((uint32) (((const uchar*) (A))[4])) << 8) |\ + (((uint32) (((const uchar*) (A))[3])) << 16) |\ + (((uint32) (((const uchar*) (A))[2])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\ (((uint32) (((const uchar*) (A))[0]) << 8)))) <<\ 32)) #endif /* HAVE_mi_uint6korr */ #ifndef HAVE_mi_uint7korr -#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\ - (((uint32) (((const uchar*) (A))[5])) << 8) +\ - (((uint32) (((const uchar*) (A))[4])) << 16) +\ - (((uint32) (((const uchar*) (A))[3])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\ - (((uint32) (((const uchar*) (A))[1])) << 8) +\ +#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\ + (((uint32) (((const uchar*) (A))[5])) << 8) |\ + (((uint32) (((const uchar*) (A))[4])) << 16) |\ + (((uint32) (((const uchar*) (A))[3])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\ + (((uint32) (((const uchar*) (A))[1])) << 8) |\ (((uint32) (((const uchar*) (A))[0])) << 16))) <<\ 32)) #endif /* HAVE_mi_uint7korr */ #ifndef HAVE_mi_uint8korr -#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\ - (((uint32) (((const uchar*) (A))[6])) << 8) +\ - (((uint32) (((const uchar*) (A))[5])) << 16) +\ - (((uint32) (((const uchar*) (A))[4])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\ - (((uint32) (((const uchar*) (A))[2])) << 8) +\ - (((uint32) (((const uchar*) (A))[1])) << 16) +\ +#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\ + (((uint32) (((const uchar*) (A))[6])) << 8) |\ + (((uint32) (((const uchar*) (A))[5])) << 16) |\ + (((uint32) (((const uchar*) (A))[4])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\ + (((uint32) (((const uchar*) (A))[2])) << 8) |\ + (((uint32) (((const uchar*) (A))[1])) << 16) |\ (((uint32) (((const uchar*) (A))[0])) << 24))) <<\ 32)) #endif /* HAVE_mi_uint8korr */ |