#include "ll.h"
void
cput(uint c)
{
*cbp++ = c;
if(-- cbc <= 0)
cflush();
}
void
wput(long l)
{
cbp[0] = l>>8;
cbp[1] = l;
cbp += 2;
cbc -= 2;
if(cbc <= 0)
cflush();
}
void
wputl(long l)
{
cbp[0] = l;
cbp[1] = l>>8;
cbp += 2;
cbc -= 2;
if(cbc <= 0)
cflush();
}
void
lput(long l)
{
cbp[0] = l>>24;
cbp[1] = l>>16;
cbp[2] = l>>8;
cbp[3] = l;
cbp += 4;
cbc -= 4;
if(cbc <= 0)
cflush();
}
void
lputl(long l)
{
cbp[3] = l>>24;
cbp[2] = l>>16;
cbp[1] = l>>8;
cbp[0] = l;
cbp += 4;
cbc -= 4;
if(cbc <= 0)
cflush();
}
void
llput(vlong v)
{
lput(v>>32);
lput(v);
}
void
llputl(vlong v)
{
lputl(v);
lputl(v>>32);
}
void
cflush(void)
{
int n;
n = sizeof(buf.cbuf) - cbc;
if(n)
write(cout, buf.cbuf, n);
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
}
void
strnput(char *s, int n)
{
for(; *s && n > 0; s++){
cput(*s);
n--;
}
while(n > 0){
cput(0);
n--;
}
}
|