/*
* output one group of 3 bytes, pointed at by p, on file f.
*/
outdec(p, f)
char *p;
FILE *f;
{
int c1, c2, c3, c4;
c1 = *p >> 2;
c2 = (*p << 4) & 060 | (p[1] >> 4) & 017;
c3 = (p[1] << 2) & 074 | (p[2] >> 6) & 03;
c4 = p[2] & 077;
putc(ENC(c1), f);
putc(ENC(c2), f);
putc(ENC(c3), f);
putc(ENC(c4), f);
}
/* ENC is the basic 1 character encoding function to make a char printing */
#define ENC(c) (((c) & 077) + ' ')
/*
with luck with will compile to:
mov al, [esi]
shr al, 2
add al, ' '
stosb
mov al, [esi]
shl al, 4
and al, 60o
mov ah, [esi+1]
shr ah, 4
and ah, 017o
or al,ah
add al, ' '
stosb
mov al, [esi+1]
shl al, 2
and al, 074o
mov ah, [esi+2]
shr ah, 6
and ah, 03o
or al,ah
add al, ' '
stosb
mov al,[esi+2]
and al, 077o
add al, ' '
stosb
which is beaten all to hell by:
lodsw
dec esi
mov edx,eax
mov ecx,4
.Repeat
and al, 00111111y
add al, ' '
stosb
shr edx, 6
mov al,dl
.Untilcxz