0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-11-08 23:27:15 -05:00

saa: fix indentation

Apply standard indentation to the SAA code, not sure why it was
different...
This commit is contained in:
H. Peter Anvin
2008-06-19 23:09:11 -07:00
parent b2a5fda157
commit 3c7e6b396f
2 changed files with 128 additions and 128 deletions

34
saa.c
View File

@@ -51,7 +51,8 @@ static void saa_extend(struct SAA *s)
size_t windex = s->wblk - s->blk_ptrs; size_t windex = s->wblk - s->blk_ptrs;
s->nblkptrs <<= 1; s->nblkptrs <<= 1;
s->blk_ptrs = nasm_realloc(s->blk_ptrs, s->nblkptrs*sizeof(char *)); s->blk_ptrs =
nasm_realloc(s->blk_ptrs, s->nblkptrs * sizeof(char *));
s->rblk = s->blk_ptrs + rindex; s->rblk = s->blk_ptrs + rindex;
s->wblk = s->blk_ptrs + windex; s->wblk = s->blk_ptrs + windex;
@@ -66,12 +67,12 @@ void *saa_wstruct(struct SAA *s)
void *p; void *p;
if (s->wpos % s->elem_len) if (s->wpos % s->elem_len)
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
"misaligned wpos in saa_wstruct"); "misaligned wpos in saa_wstruct");
if (s->wpos + s->elem_len > s->blk_len) { if (s->wpos + s->elem_len > s->blk_len) {
if (s->wpos != s->blk_len) if (s->wpos != s->blk_len)
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
"unfilled block in saa_wstruct"); "unfilled block in saa_wstruct");
if (s->wptr + s->elem_len > s->length) if (s->wptr + s->elem_len > s->length)
@@ -134,7 +135,7 @@ void *saa_rstruct(struct SAA *s)
return NULL; return NULL;
if (s->rpos % s->elem_len) if (s->rpos % s->elem_len)
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
"misaligned rpos in saa_rstruct"); "misaligned rpos in saa_rstruct");
if (s->rpos + s->elem_len > s->blk_len) { if (s->rpos + s->elem_len > s->blk_len) {
@@ -149,7 +150,7 @@ void *saa_rstruct(struct SAA *s)
return p; return p;
} }
const void *saa_rbytes(struct SAA *s, size_t *lenp) const void *saa_rbytes(struct SAA *s, size_t * lenp)
{ {
const void *p; const void *p;
size_t len; size_t len;
@@ -184,7 +185,8 @@ void saa_rnbytes(struct SAA *s, void *data, size_t len)
char *d = data; char *d = data;
if (s->rptr + len > s->datalen) { if (s->rptr + len > s->datalen) {
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_rnbytes"); nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
"overrun in saa_rnbytes");
return; return;
} }
@@ -206,14 +208,14 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
{ {
size_t ix; size_t ix;
if (posn+len > s->datalen) { if (posn + len > s->datalen) {
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fread"); nasm_malloc_error(ERR_PANIC | ERR_NOFILE, "overrun in saa_fread");
return; return;
} }
if (likely(s->blk_len == SAA_BLKLEN)) { if (likely(s->blk_len == SAA_BLKLEN)) {
ix = posn >> SAA_BLKSHIFT; ix = posn >> SAA_BLKSHIFT;
s->rpos = posn & (SAA_BLKLEN-1); s->rpos = posn & (SAA_BLKLEN - 1);
} else { } else {
ix = posn / s->blk_len; ix = posn / s->blk_len;
s->rpos = posn % s->blk_len; s->rpos = posn % s->blk_len;
@@ -231,13 +233,13 @@ void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
if (posn > s->datalen) { if (posn > s->datalen) {
/* Seek beyond the end of the existing array not supported */ /* Seek beyond the end of the existing array not supported */
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite"); nasm_malloc_error(ERR_PANIC | ERR_NOFILE, "overrun in saa_fwrite");
return; return;
} }
if (likely(s->blk_len == SAA_BLKLEN)) { if (likely(s->blk_len == SAA_BLKLEN)) {
ix = posn >> SAA_BLKSHIFT; ix = posn >> SAA_BLKSHIFT;
s->wpos = posn & (SAA_BLKLEN-1); s->wpos = posn & (SAA_BLKLEN - 1);
} else { } else {
ix = posn / s->blk_len; ix = posn / s->blk_len;
s->wpos = posn % s->blk_len; s->wpos = posn % s->blk_len;
@@ -333,8 +335,7 @@ void saa_wleb128u(struct SAA *psaa, int value)
ptemp = temp; ptemp = temp;
len = 0; len = 0;
do do {
{
byte = value & 127; byte = value & 127;
value >>= 7; value >>= 7;
if (value != 0) /* more bytes to come */ if (value != 0) /* more bytes to come */
@@ -359,15 +360,14 @@ void saa_wleb128s(struct SAA *psaa, int value)
negative = (value < 0); negative = (value < 0);
size = sizeof(int) * 8; size = sizeof(int) * 8;
len = 0; len = 0;
while(more) while (more) {
{
byte = value & 0x7f; byte = value & 0x7f;
value >>= 7; value >>= 7;
if (negative) if (negative)
/* sign extend */ /* sign extend */
value |= - (1 <<(size - 7)); value |= -(1 << (size - 7));
/* sign bit of byte is second high order bit (0x40) */ /* sign bit of byte is second high order bit (0x40) */
if ((value == 0 && ! (byte & 0x40)) || if ((value == 0 && !(byte & 0x40)) ||
((value == -1) && (byte & 0x40))) ((value == -1) && (byte & 0x40)))
more = 0; more = 0;
else else