Ignore:
Timestamp:
Apr 22, 2011, 4:12:56 AM (11 years ago)
Author:
Sam Hocevar
Message:

core: replace all byte swapping macros with inline functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/specs.cpp

    r524 r525  
    600600  uint16_t x;
    601601  read(&x,2);
    602   return uint16_to_local(x);
     602  return lstl(x);
    603603}
    604604
     
    608608  uint32_t x;
    609609  read(&x,4);
    610   return uint32_to_local(x);
     610  return lltl(x);
    611611}
    612612
     
    618618void bFILE::write_uint16(uint16_t x)
    619619{
    620   x=uint16_to_local(x);
     620  x=lstl(x);
    621621  write(&x,2);
    622622}
     
    625625void bFILE::write_uint32(uint32_t x)
    626626{
    627   x=uint32_to_local(x);
     627  x=lltl(x);
    628628  write(&x,4);
    629629}
     
    888888    if (fp->write(&flags,1)!=1)                     return 0;
    889889
    890     data_size=uint32_to_intel((*e)->size);
     890    data_size=lltl((*e)->size);
    891891    if (fp->write((char *)&data_size,4)!=4)              return 0;
    892     offset=uint32_to_intel((*e)->offset);
     892    offset=lltl((*e)->offset);
    893893    if (fp->write((char *)&offset,4)!=4)                  return 0;
    894894
     
    914914  uint16_t x;
    915915  fread(&x,1,2,fp);
    916   return uint16_to_local(x);
     916  return lstl(x);
    917917}
    918918
     
    921921  uint32_t x;
    922922  fread(&x,1,4,fp);
    923   return uint32_to_local(x);
     923  return lltl(x);
    924924}
    925925void write_uint16(FILE *fp, uint16_t x)
    926926{
    927   x=uint16_to_local(x);
     927  x=lstl(x);
    928928  fwrite(&x,1,2,fp);
    929929}
     
    931931void write_uint32(FILE *fp, uint32_t x)
    932932{
    933   x=uint32_to_local(x);
     933  x=lltl(x);
    934934  fwrite(&x,1,4,fp);
    935935}
     
    937937uint8_t read_uint8(FILE *fp) { return fgetc(fp)&0xff; }
    938938void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }
    939 
    940 uint32_t read_other_uint32(FILE *fp)
    941 {
    942   uint32_t x;
    943   fread(&x,1,4,fp);
    944   return big_uint32_to_local(x);
    945 }
    946 
    947 uint16_t read_other_uint16(FILE *fp)
    948 {
    949   uint16_t x;
    950   fread(&x,1,2,fp);
    951   return big_uint16_to_local(x);
    952 }
    953 
    954 
    955 void write_other_uint16(FILE *fp, uint16_t x)
    956 {
    957   x=big_uint16_to_local(x);
    958   fwrite(&x,1,2,fp);
    959 }
    960 
    961 void write_other_int32(FILE *fp, uint32_t x)
    962 {
    963   x=big_uint32_to_local(x);
    964   fwrite(&x,1,4,fp);
    965 }
    966939
    967940void spec_directory::remove(spec_entry *e)
Note: See TracChangeset for help on using the changeset viewer.