mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
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.
This commit is contained in:
parent
1cff81e356
commit
8cc5aa7829
5
saa.c
5
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user