summaryrefslogtreecommitdiff
path: root/saa.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-10 09:31:31 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-10 09:31:31 -0700
commit8cc5aa78291843c10931ed3c738290df0b643279 (patch)
treea46aad32b1afebd6ce0b89438093a9de11773c8d /saa.c
parent1cff81e3562645b55fbe4beb7856c5ef8b7e910a (diff)
downloadnasm-8cc5aa78291843c10931ed3c738290df0b643279.tar.gz
nasm-8cc5aa78291843c10931ed3c738290df0b643279.tar.bz2
nasm-8cc5aa78291843c10931ed3c738290df0b643279.zip
SAA: optimize all power-of-two lengths
We can actually use the shift optimization whenever blk_len == SAA_BLKLEN, which will be true for all powers of two.
Diffstat (limited to 'saa.c')
-rw-r--r--saa.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/saa.c b/saa.c
index 046659e..51123da 100644
--- a/saa.c
+++ b/saa.c
@@ -211,7 +211,7 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
return;
}
- if (s->elem_len == 1) {
+ if (s->blk_len == SAA_BLKLEN) {
ix = posn >> SAA_BLKSHIFT;
s->rpos = posn & (SAA_BLKLEN-1);
} else {
@@ -234,9 +234,8 @@ void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite");
return;
}
-
- if (s->elem_len == 1) {
+ if (s->blk_len == SAA_BLKLEN) {
ix = posn >> SAA_BLKSHIFT;
s->wpos = posn & (SAA_BLKLEN-1);
} else {