Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Post code

Name: Anonymous 2011-10-06 9:06

Any code you work with right now, and we'll criticize it(or not).

Name: Anonymous 2011-10-06 9:14

#define ngetext(string) strrchr(string,'.')
#define getext(string) ngetext(string)?ngetext(string):".???"
#define pos1(pos1_int1) (1<<(pos1_int1))
#define getbit(getbit_int,getbit_pos)    ((getbit_int&(pos1(getbit_pos)))>>getbit_pos)
#define bitchar(bitchar_bit)    (48|bitchar_bit)
#define getbitc(getbitc_int,getbitc_pos)  bitchar(getbit(getbitc_int,getbitc_pos))
#define digit2_byte(digit2_dig) ((digit2_dig)&0xF)
#define ten_e(ten_ex) (u8)(pow(10,ten_ex))
#define dec2byte(array_dec,dec_amult)  ((digit2_byte(array_dec))*ten_e(dec_amult))
#define deccar(deccar_str,deccar_ind,deccar_mul) dec2byte(deccar_str[deccar_ind+deccar_mul],deccar_mul)
#define declsum(declo18_str,declo18_ind) (deccar(declo18_str,declo18_ind,0)+deccar(declo18_str,declo18_ind,1)+deccar(declo18_str,declo18_ind,2)+deccar(declo18_str,declo18_ind,3)+deccar(declo18_str,declo18_ind,4)+deccar(declo18_str,declo18_ind,5)+deccar(declo18_str,declo18_ind,6)+deccar(declo18_str,declo18_ind,7)+deccar(declo18_str,declo18_ind,8)+deccar(declo18_str,declo18_ind,9)+deccar(declo18_str,declo18_ind,10)+deccar(declo18_str,declo18_ind,11)+deccar(declo18_str,declo18_ind,12)+deccar(declo18_str,declo18_ind,13)+deccar(declo18_str,declo18_ind,14)+deccar(declo18_str,declo18_ind,15)+deccar(declo18_str,declo18_ind,16)+deccar(declo18_str,declo18_ind,17))
//.dec2byte((dec2quads_String)[(dec2quads_Istart)+0],0)
//10*((dec2quads_String)[(dec2quads_Istart)+1]-48)
/* get
a^-1 = 1/a;     (-1)*a = -a.
    a^{m + n} = a^m * a^n
    a^{m - n} ={a^m}/{a^n}
    (a^m)^n = a^{m* n}
    (a * b)^n = a^n * b^n
*/
#define dec2quads(dec2quads_String,dec2quads_Slen,dec2quads_Retq,dec2quads_Istart) ;u8* (dec2quads_Retq)=malloc((((dec2quads_Slen)/18)+1)*8);for((dec2quads_Istart)=0;(dec2quads_Istart)<(dec2quads_Slen);(dec2quads_Istart)+=18){(dec2quads_Retq)[(dec2quads_Istart)/18]=declsum(dec2quads_Retq,dec2quads_Istart);}
// s/18 dec=x+1 8 bytes
char* merge(char* str1,const char* str2){
char* res=malloc(strlen(str1)+strlen(str2)+1);
strcpy(res,str1);strcpy(res+strlen(str1),str2);return res;}
s8 stoquad(char* str){s8 res;sscanf(str,"%lli",&res);return res;}
u8 stouquad (char* str){u8 res;sscanf(str,"%llu",&res);return res;}
//char* slice(char* str,u8 len){}
u1* bytetodec(u1* str,u4 srclen){
  /*SLow&horrible conversion of byte into decimal compatible arrays 000*/
u1* res=malloc(3*(srclen+1));
u4 i;for(i=0;i<srclen;i++){
if(str[i]<10){//decode:first byte from end by3 byte groups.
res[i*3]='1';
res[(i*3)+1]='0';
res[(i*3)+2]=str[i]+48;continue;}
if(str[i]<100){res[i*3]='1';
res[(i*3)+1]=(str[i]/10)+48;//num+48
res[(i*3)+2]=(str[i]%10)+48;continue;}
if(str[i]<200){res[i*3]='2';
res[(i*3)+1]=((str[i]-100)/10)+48;
res[(i*3)+2]=(str[i]%10)+48;continue;}
res[i*3]='3';
res[(i*3)+1]=((str[i]-200)/10)+48;
res[(i*3)+2]=(str[i]%10)+48;
;}
;
return res;
}


u1* dectobyte(u1* dec,u8 size){
u8 outsize=size/3;
u1* res=malloc(size/3);
for(u4 i=0;i<outsize;i++){
res[i]=((dec[i*3]-49)*100)+((dec[(i*3)+1]-48)*10)+(dec[(i*3)+2]-48);};
return res;}
//#define bbits(b)  (b&0x80?'1':'0')##(byte & 0x40 ? 1 : 0)##(byte & 0x20 ? 1 : 0)##(byte & 0x10 ? 1 : 0)##(byte & 0x08 ? 1 : 0)##(byte & 0x04 ? 1 : 0)##(byte & 0x02 ? 1 : 0)##(byte & 0x01 ? 1 : 0)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List