Changeset 1394

Show
Ignore:
Timestamp:
05/15/09 03:13:21 (16 months ago)
Author:
takkaria
Message:

Remove some pointless faff from z-file.c.

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/z-file.c

    r1266 r1394  
    235235 
    236236 
    237 /*** Support for byte-swapping for endian-indepedent files ***/ 
    238  
    239 static bool is_bigendian(void) 
    240 { 
    241         int i = 1; 
    242         char *p = (char *)&i; 
    243  
    244         if (p[0] != 1) 
    245                 return TRUE; 
    246  
    247         return FALSE; 
    248 } 
    249  
    250 u16b flip_u16b(u16b arg) 
    251 { 
    252         u16b ret; 
    253         char *in = (char *)&arg; 
    254         char *out = (char *)&ret; 
    255  
    256         if (is_bigendian()) 
    257                 return arg; 
    258  
    259         out[0] = in[1]; 
    260         out[1] = in[0]; 
    261  
    262         return ret; 
    263 } 
    264  
    265 u32b flip_u32b(u32b arg) 
    266 { 
    267         u32b ret; 
    268         char *in = (char *)&arg; 
    269         char *out = (char *)&ret; 
    270  
    271         if (is_bigendian()) 
    272                 return arg; 
    273  
    274         out[0] = in[3]; 
    275         out[1] = in[2]; 
    276         out[2] = in[1]; 
    277         out[3] = in[0]; 
    278  
    279         return ret; 
    280 } 
    281  
    282  
    283  
    284237/*** File-handling API ***/ 
    285238 
  • trunk/src/z-file.h

    r1263 r1394  
    3939 */ 
    4040size_t path_build(char *buf, size_t len, const char *base, const char *leaf); 
    41  
    42  
    43  
    44 /*** Byte-flipping functions ***/ 
    45  
    46 /** 
    47  * "Flip" the bits of the integer specified in `arg` to make them big-endian. 
    48  * Useful when writing to files intended to be portable across systems. 
    49  *  
    50  * Returns the flipped value, or the original if the current system is already 
    51  * big-endian. 
    52  */ 
    53 u16b flip_u16b(u16b arg); 
    54 u32b flip_u32b(u32b arg); 
    5541 
    5642