Skip to content

Commit a66eebf

Browse files
committed
MDEV-21981 Replace arithmetic + with bitwise OR when possible
Several macros such as sint2korr() and uint4korr() are using the arithmetic + operator while a bitwise or operator would suffice. GCC 5 and clang 5 and later can detect patterns consisting of bitwise or and shifts by multiples of 8 bits, such as those used in the InnoDB function mach_read_from_4(). They actually translate that verbose low-level code into high-level machine language (i486 bswap instruction or fused into the Haswell movbe instruction). We should do the same for MariaDB Server code that is outside InnoDB. Note: The Microsoft C compiler is lacking this optimization. There, we might consider using _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64(). But, those would lead to unaligned reads, which are bad for reasons stated in MDEV-20277. Besides, outside InnoDB, most data is already being stored in the native little-endian format of that compiler.
1 parent 6960e9e commit a66eebf

File tree

7 files changed

+130
-123
lines changed

7 files changed

+130
-123
lines changed

include/byte_order_generic.h

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2020, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -17,7 +18,7 @@
1718
Endianness-independent definitions for architectures other
1819
than the x86 architecture.
1920
*/
20-
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
21+
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\
2122
((int16) ((int16) (A)[1]) << 8))
2223
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
2324
(((uint32) 255L << 24) | \
@@ -27,38 +28,38 @@
2728
(((uint32) (uchar) (A)[2]) << 16) |\
2829
(((uint32) (uchar) (A)[1]) << 8) | \
2930
((uint32) (uchar) (A)[0])))
30-
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
31-
(((int32) ((uchar) (A)[1]) << 8)) +\
32-
(((int32) ((uchar) (A)[2]) << 16)) +\
31+
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\
32+
(((int32) ((uchar) (A)[1]) << 8)) |\
33+
(((int32) ((uchar) (A)[2]) << 16)) |\
3334
(((int32) ((int16) (A)[3]) << 24)))
3435
#define sint8korr(A) (longlong) uint8korr(A)
35-
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
36+
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\
3637
((uint16) ((uchar) (A)[1]) << 8))
37-
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
38-
(((uint32) ((uchar) (A)[1])) << 8) +\
38+
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
39+
(((uint32) ((uchar) (A)[1])) << 8) |\
3940
(((uint32) ((uchar) (A)[2])) << 16))
40-
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
41-
(((uint32) ((uchar) (A)[1])) << 8) +\
42-
(((uint32) ((uchar) (A)[2])) << 16) +\
41+
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
42+
(((uint32) ((uchar) (A)[1])) << 8) |\
43+
(((uint32) ((uchar) (A)[2])) << 16) |\
4344
(((uint32) ((uchar) (A)[3])) << 24))
44-
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
45-
(((uint32) ((uchar) (A)[1])) << 8) +\
46-
(((uint32) ((uchar) (A)[2])) << 16) +\
47-
(((uint32) ((uchar) (A)[3])) << 24)) +\
45+
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
46+
(((uint32) ((uchar) (A)[1])) << 8) |\
47+
(((uint32) ((uchar) (A)[2])) << 16) |\
48+
(((uint32) ((uchar) (A)[3])) << 24)) |\
4849
(((ulonglong) ((uchar) (A)[4])) << 32))
49-
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
50-
(((uint32) ((uchar) (A)[1])) << 8) + \
51-
(((uint32) ((uchar) (A)[2])) << 16) + \
52-
(((uint32) ((uchar) (A)[3])) << 24)) + \
53-
(((ulonglong) ((uchar) (A)[4])) << 32) + \
50+
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
51+
(((uint32) ((uchar) (A)[1])) << 8) | \
52+
(((uint32) ((uchar) (A)[2])) << 16) | \
53+
(((uint32) ((uchar) (A)[3])) << 24)) | \
54+
(((ulonglong) ((uchar) (A)[4])) << 32) | \
5455
(((ulonglong) ((uchar) (A)[5])) << 40))
55-
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
56-
(((uint32) ((uchar) (A)[1])) << 8) +\
57-
(((uint32) ((uchar) (A)[2])) << 16) +\
58-
(((uint32) ((uchar) (A)[3])) << 24)) +\
59-
(((ulonglong) (((uint32) ((uchar) (A)[4])) +\
60-
(((uint32) ((uchar) (A)[5])) << 8) +\
61-
(((uint32) ((uchar) (A)[6])) << 16) +\
56+
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
57+
(((uint32) ((uchar) (A)[1])) << 8) |\
58+
(((uint32) ((uchar) (A)[2])) << 16) |\
59+
(((uint32) ((uchar) (A)[3])) << 24)) |\
60+
(((ulonglong) (((uint32) ((uchar) (A)[4])) |\
61+
(((uint32) ((uchar) (A)[5])) << 8) |\
62+
(((uint32) ((uchar) (A)[6])) << 16) |\
6263
(((uint32) ((uchar) (A)[7])) << 24))) <<\
6364
32))
6465
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\

include/byte_order_generic_x86.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2020, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -27,20 +28,20 @@
2728
((uint32) (uchar) (A)[0])))
2829
#define sint4korr(A) (*((const long *) (A)))
2930
#define uint2korr(A) (*((const uint16 *) (A)))
30-
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
31-
(((uint32) ((uchar) (A)[1])) << 8) +\
31+
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
32+
(((uint32) ((uchar) (A)[1])) << 8) |\
3233
(((uint32) ((uchar) (A)[2])) << 16))
3334
#define uint4korr(A) (*((const uint32 *) (A)))
34-
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
35-
(((uint32) ((uchar) (A)[1])) << 8) +\
36-
(((uint32) ((uchar) (A)[2])) << 16) +\
37-
(((uint32) ((uchar) (A)[3])) << 24)) +\
35+
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
36+
(((uint32) ((uchar) (A)[1])) << 8) |\
37+
(((uint32) ((uchar) (A)[2])) << 16) |\
38+
(((uint32) ((uchar) (A)[3])) << 24)) |\
3839
(((ulonglong) ((uchar) (A)[4])) << 32))
39-
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
40-
(((uint32) ((uchar) (A)[1])) << 8) + \
41-
(((uint32) ((uchar) (A)[2])) << 16) + \
42-
(((uint32) ((uchar) (A)[3])) << 24)) + \
43-
(((ulonglong) ((uchar) (A)[4])) << 32) + \
40+
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
41+
(((uint32) ((uchar) (A)[1])) << 8) | \
42+
(((uint32) ((uchar) (A)[2])) << 16) | \
43+
(((uint32) ((uchar) (A)[3])) << 24)) | \
44+
(((ulonglong) ((uchar) (A)[4])) << 32) | \
4445
(((ulonglong) ((uchar) (A)[5])) << 40))
4546
#define uint8korr(A) (*((const ulonglong *) (A)))
4647
#define sint8korr(A) (*((const longlong *) (A)))

include/byte_order_generic_x86_64.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2020, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -28,8 +29,8 @@
2829
((uint32) (uchar) (A)[0])))
2930
#define sint4korr(A) (int32) (*((int32 *) (A)))
3031
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
31-
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
32-
(((uint32) ((uchar) (A)[1])) << 8) +\
32+
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
33+
(((uint32) ((uchar) (A)[1])) << 8) |\
3334
(((uint32) ((uchar) (A)[2])) << 16))
3435
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
3536

@@ -53,7 +54,7 @@ static inline ulonglong uint6korr(const void *p)
5354
#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
5455
*((uint16*)(pT))= (uint16) (A);\
5556
} while (0)
56-
57+
5758
#define int3store(T,A) do { *(T)= (uchar) ((A));\
5859
*(T+1)=(uchar) (((uint) (A) >> 8));\
5960
*(T+2)=(uchar) (((A) >> 16));\

include/myisampack.h

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define MYISAMPACK_INCLUDED
33

44
/* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc.
5+
Copyright (c) 2020, MariaDB Corporation.
56
Use is subject to license terms.
67
78
This program is free software; you can redistribute it and/or modify
@@ -28,7 +29,7 @@
2829
#define mi_sint1korr(A) ((int8)(*A))
2930
#define mi_uint1korr(A) ((uint8)(*A))
3031

31-
#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\
32+
#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\
3233
((int16) ((int16) ((const char*) (A))[0]) << 8)))
3334
#define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \
3435
(((uint32) 255L << 24) | \
@@ -38,58 +39,58 @@
3839
(((uint32) ((const uchar*) (A))[0]) << 16) |\
3940
(((uint32) ((const uchar*) (A))[1]) << 8) | \
4041
((uint32) ((const uchar*) (A))[2])))
41-
#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\
42-
((int32) (((const uchar*) (A))[2]) << 8) +\
43-
((int32) (((const uchar*) (A))[1]) << 16) +\
42+
#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\
43+
((int32) (((const uchar*) (A))[2]) << 8) |\
44+
((int32) (((const uchar*) (A))[1]) << 16) |\
4445
((int32) ((int16) ((const char*) (A))[0]) << 24)))
4546
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
46-
#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\
47+
#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\
4748
((uint16) (((const uchar*) (A))[0]) << 8)))
48-
#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\
49-
(((uint32) (((const uchar*) (A))[1])) << 8) +\
49+
#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\
50+
(((uint32) (((const uchar*) (A))[1])) << 8) |\
5051
(((uint32) (((const uchar*) (A))[0])) << 16)))
51-
#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\
52-
(((uint32) (((const uchar*) (A))[2])) << 8) +\
53-
(((uint32) (((const uchar*) (A))[1])) << 16) +\
52+
#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\
53+
(((uint32) (((const uchar*) (A))[2])) << 8) |\
54+
(((uint32) (((const uchar*) (A))[1])) << 16) |\
5455
(((uint32) (((const uchar*) (A))[0])) << 24)))
5556

5657
#ifndef HAVE_mi_uint5korr
57-
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\
58-
(((uint32) (((const uchar*) (A))[3])) << 8) +\
59-
(((uint32) (((const uchar*) (A))[2])) << 16) +\
60-
(((uint32) (((const uchar*) (A))[1])) << 24)) +\
58+
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\
59+
(((uint32) (((const uchar*) (A))[3])) << 8) |\
60+
(((uint32) (((const uchar*) (A))[2])) << 16) |\
61+
(((uint32) (((const uchar*) (A))[1])) << 24)) |\
6162
(((ulonglong) (((const uchar*) (A))[0])) << 32))
6263
#endif /* HAVE_mi_uint5korr */
6364

6465
#ifndef HAVE_mi_uint6korr
65-
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\
66-
(((uint32) (((const uchar*) (A))[4])) << 8) +\
67-
(((uint32) (((const uchar*) (A))[3])) << 16) +\
68-
(((uint32) (((const uchar*) (A))[2])) << 24)) +\
69-
(((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\
66+
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\
67+
(((uint32) (((const uchar*) (A))[4])) << 8) |\
68+
(((uint32) (((const uchar*) (A))[3])) << 16) |\
69+
(((uint32) (((const uchar*) (A))[2])) << 24)) |\
70+
(((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\
7071
(((uint32) (((const uchar*) (A))[0]) << 8)))) <<\
7172
32))
7273
#endif /* HAVE_mi_uint6korr */
7374

7475
#ifndef HAVE_mi_uint7korr
75-
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\
76-
(((uint32) (((const uchar*) (A))[5])) << 8) +\
77-
(((uint32) (((const uchar*) (A))[4])) << 16) +\
78-
(((uint32) (((const uchar*) (A))[3])) << 24)) +\
79-
(((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\
80-
(((uint32) (((const uchar*) (A))[1])) << 8) +\
76+
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\
77+
(((uint32) (((const uchar*) (A))[5])) << 8) |\
78+
(((uint32) (((const uchar*) (A))[4])) << 16) |\
79+
(((uint32) (((const uchar*) (A))[3])) << 24)) |\
80+
(((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\
81+
(((uint32) (((const uchar*) (A))[1])) << 8) |\
8182
(((uint32) (((const uchar*) (A))[0])) << 16))) <<\
8283
32))
8384
#endif /* HAVE_mi_uint7korr */
8485

8586
#ifndef HAVE_mi_uint8korr
86-
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\
87-
(((uint32) (((const uchar*) (A))[6])) << 8) +\
88-
(((uint32) (((const uchar*) (A))[5])) << 16) +\
89-
(((uint32) (((const uchar*) (A))[4])) << 24)) +\
90-
(((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\
91-
(((uint32) (((const uchar*) (A))[2])) << 8) +\
92-
(((uint32) (((const uchar*) (A))[1])) << 16) +\
87+
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\
88+
(((uint32) (((const uchar*) (A))[6])) << 8) |\
89+
(((uint32) (((const uchar*) (A))[5])) << 16) |\
90+
(((uint32) (((const uchar*) (A))[4])) << 24)) |\
91+
(((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\
92+
(((uint32) (((const uchar*) (A))[2])) << 8) |\
93+
(((uint32) (((const uchar*) (A))[1])) << 16) |\
9394
(((uint32) (((const uchar*) (A))[0])) << 24))) <<\
9495
32))
9596
#endif /* HAVE_mi_uint8korr */

storage/maria/ma_loghandler.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (C) 2007 MySQL AB & Sanja Belkin. 2010 Monty Program Ab.
2+
Copyright (c) 2020, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -5440,15 +5441,15 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
54405441
src + 1 + LSN_STORE_SIZE));
54415442
DBUG_RETURN(src + 1 + LSN_STORE_SIZE);
54425443
}
5443-
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src));
5444+
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) | *((uint8*)src));
54445445
break;
54455446
case 1:
54465447
diff= uint2korr(src);
5447-
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) + diff);
5448+
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) | diff);
54485449
break;
54495450
case 2:
54505451
diff= uint3korr(src);
5451-
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) + diff);
5452+
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) | diff);
54525453
break;
54535454
case 3:
54545455
{

storage/maria/ma_packrec.c

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
2+
Copyright (c) 2020, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -1157,10 +1158,10 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
11571158
bit_buff->error=1;
11581159
return; /* Can't be right */
11591160
}
1160-
bit_buff->current_byte= (bit_buff->current_byte << 32) +
1161-
((((uint) bit_buff->pos[3])) +
1162-
(((uint) bit_buff->pos[2]) << 8) +
1163-
(((uint) bit_buff->pos[1]) << 16) +
1161+
bit_buff->current_byte= (bit_buff->current_byte << 32) |
1162+
((((uint) bit_buff->pos[3])) |
1163+
(((uint) bit_buff->pos[2]) << 8) |
1164+
(((uint) bit_buff->pos[1]) << 16) |
11641165
(((uint) bit_buff->pos[0]) << 24));
11651166
bit_buff->pos+=4;
11661167
bits+=32;
@@ -1251,23 +1252,23 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
12511252
return; /* Can't be right */
12521253
}
12531254
#if BITS_SAVED == 32
1254-
bit_buff->current_byte= (bit_buff->current_byte << 24) +
1255-
(((uint) ((uchar) bit_buff->pos[2]))) +
1256-
(((uint) ((uchar) bit_buff->pos[1])) << 8) +
1255+
bit_buff->current_byte= (bit_buff->current_byte << 24) |
1256+
(((uint) ((uchar) bit_buff->pos[2]))) |
1257+
(((uint) ((uchar) bit_buff->pos[1])) << 8) |
12571258
(((uint) ((uchar) bit_buff->pos[0])) << 16);
12581259
bit_buff->pos+=3;
12591260
bits+=24;
12601261
#else
12611262
if (bits) /* We must have at leasts 9 bits */
12621263
{
1263-
bit_buff->current_byte= (bit_buff->current_byte << 8) +
1264+
bit_buff->current_byte= (bit_buff->current_byte << 8) |
12641265
(uint) ((uchar) bit_buff->pos[0]);
12651266
bit_buff->pos++;
12661267
bits+=8;
12671268
}
12681269
else
12691270
{
1270-
bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
1271+
bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
12711272
((uint) ((uchar) bit_buff->pos[1]));
12721273
bit_buff->pos+=2;
12731274
bits+=16;
@@ -1291,14 +1292,14 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
12911292
if (bits < 8)
12921293
{ /* We don't need to check end */
12931294
#if BITS_SAVED == 32
1294-
bit_buff->current_byte= (bit_buff->current_byte << 24) +
1295-
(((uint) ((uchar) bit_buff->pos[2]))) +
1296-
(((uint) ((uchar) bit_buff->pos[1])) << 8) +
1295+
bit_buff->current_byte= (bit_buff->current_byte << 24) |
1296+
(((uint) ((uchar) bit_buff->pos[2]))) |
1297+
(((uint) ((uchar) bit_buff->pos[1])) << 8) |
12971298
(((uint) ((uchar) bit_buff->pos[0])) << 16);
12981299
bit_buff->pos+=3;
12991300
bits+=24;
13001301
#else
1301-
bit_buff->current_byte= (bit_buff->current_byte << 8) +
1302+
bit_buff->current_byte= (bit_buff->current_byte << 8) |
13021303
(uint) ((uchar) bit_buff->pos[0]);
13031304
bit_buff->pos+=1;
13041305
bits+=8;
@@ -1488,25 +1489,25 @@ static void fill_buffer(MARIA_BIT_BUFF *bit_buff)
14881489
return;
14891490
}
14901491
#if BITS_SAVED == 64
1491-
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
1492-
(((uint) ((uchar) bit_buff->pos[6])) << 8) +
1493-
(((uint) ((uchar) bit_buff->pos[5])) << 16) +
1494-
(((uint) ((uchar) bit_buff->pos[4])) << 24) +
1492+
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
1493+
(((uint) ((uchar) bit_buff->pos[6])) << 8) |
1494+
(((uint) ((uchar) bit_buff->pos[5])) << 16) |
1495+
(((uint) ((uchar) bit_buff->pos[4])) << 24) |
14951496
((ulonglong)
1496-
((((uint) ((uchar) bit_buff->pos[3]))) +
1497-
(((uint) ((uchar) bit_buff->pos[2])) << 8) +
1498-
(((uint) ((uchar) bit_buff->pos[1])) << 16) +
1497+
((((uint) ((uchar) bit_buff->pos[3]))) |
1498+
(((uint) ((uchar) bit_buff->pos[2])) << 8) |
1499+
(((uint) ((uchar) bit_buff->pos[1])) << 16) |
14991500
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
15001501
bit_buff->pos+=8;
15011502
#else
15021503
#if BITS_SAVED == 32
1503-
bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
1504-
(((uint) ((uchar) bit_buff->pos[2])) << 8) +
1505-
(((uint) ((uchar) bit_buff->pos[1])) << 16) +
1504+
bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
1505+
(((uint) ((uchar) bit_buff->pos[2])) << 8) |
1506+
(((uint) ((uchar) bit_buff->pos[1])) << 16) |
15061507
(((uint) ((uchar) bit_buff->pos[0])) << 24));
15071508
bit_buff->pos+=4;
15081509
#else
1509-
bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
1510+
bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
15101511
(((uint) ((uchar) bit_buff->pos[0])) << 8));
15111512
bit_buff->pos+=2;
15121513
#endif

0 commit comments

Comments
 (0)