summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_packrec.c
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-03-25 15:43:49 +0530
committerSatya B <satya.bn@sun.com>2009-03-25 15:43:49 +0530
commitc084645ca0cffcd4b4f93a9a5b995c3e34cff641 (patch)
tree6d7f3f43f10f0edaa30d60a9edff43af71e7b2c5 /storage/myisam/mi_packrec.c
parent1be22714122c09115b5d5930031e43e9240d1d01 (diff)
parent8b95961f16a313ddb7545c3c2be338cb2b5bc85f (diff)
downloadmariadb-git-c084645ca0cffcd4b4f93a9a5b995c3e34cff641.tar.gz
merge 5.0-bugteam to 5.1-bugteam
Diffstat (limited to 'storage/myisam/mi_packrec.c')
-rw-r--r--storage/myisam/mi_packrec.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index b5260e9c463..0f3c35235e9 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -1431,6 +1431,32 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
bit_buff->current_byte=0;
return;
}
+ else
+ {
+ uint len= 0;
+ uint i= 0;
+ /*
+ Check if the remaining buffer/record to read is less than the word size.
+ If so read byte by byte
+
+ Note: if this branch becomes a bottleneck it can be removed, assuming
+ that the second memory segment allocates 7 extra bytes (see
+ _mi_read_pack_info()).
+ */
+ len= bit_buff->end - bit_buff->pos;
+ if (len < (BITS_SAVED / 8))
+ {
+ bit_buff->current_byte= 0;
+ for (i=0 ; i < len ; i++)
+ {
+ bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1]))
+ << (8 * i));
+ }
+ bit_buff->pos= bit_buff->end;
+ return;
+ }
+ }
+
#if BITS_SAVED == 64
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
(((uint) ((uchar) bit_buff->pos[6])) << 8) +