summaryrefslogtreecommitdiff
path: root/storage/maria/ma_packrec.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria/ma_packrec.c')
-rw-r--r--storage/maria/ma_packrec.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index e2c1e353616..eab079f4fb8 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+ 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
@@ -1157,10 +1158,10 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
bit_buff->error=1;
return; /* Can't be right */
}
- bit_buff->current_byte= (bit_buff->current_byte << 32) +
- ((((uint) bit_buff->pos[3])) +
- (((uint) bit_buff->pos[2]) << 8) +
- (((uint) bit_buff->pos[1]) << 16) +
+ bit_buff->current_byte= (bit_buff->current_byte << 32) |
+ ((((uint) bit_buff->pos[3])) |
+ (((uint) bit_buff->pos[2]) << 8) |
+ (((uint) bit_buff->pos[1]) << 16) |
(((uint) bit_buff->pos[0]) << 24));
bit_buff->pos+=4;
bits+=32;
@@ -1251,23 +1252,23 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
return; /* Can't be right */
}
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
if (bits) /* We must have at leasts 9 bits */
{
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos++;
bits+=8;
}
else
{
- bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
+ bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
((uint) ((uchar) bit_buff->pos[1]));
bit_buff->pos+=2;
bits+=16;
@@ -1291,14 +1292,14 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
if (bits < 8)
{ /* We don't need to check end */
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos+=1;
bits+=8;
@@ -1488,25 +1489,25 @@ static void fill_buffer(MARIA_BIT_BUFF *bit_buff)
return;
}
#if BITS_SAVED == 64
- bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
- (((uint) ((uchar) bit_buff->pos[6])) << 8) +
- (((uint) ((uchar) bit_buff->pos[5])) << 16) +
- (((uint) ((uchar) bit_buff->pos[4])) << 24) +
+ bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
+ (((uint) ((uchar) bit_buff->pos[6])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[5])) << 16) |
+ (((uint) ((uchar) bit_buff->pos[4])) << 24) |
((ulonglong)
- ((((uint) ((uchar) bit_buff->pos[3]))) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ ((((uint) ((uchar) bit_buff->pos[3]))) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
bit_buff->pos+=8;
#else
#if BITS_SAVED == 32
- bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24));
bit_buff->pos+=4;
#else
- bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
+ bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
(((uint) ((uchar) bit_buff->pos[0])) << 8));
bit_buff->pos+=2;
#endif