def bswap_format(format):
'''Generate a structure that describes the format.'''
- if format.is_bitmask() and not format.is_array():
+ if format.is_bitmask() and not format.is_array() and format.block_size() > 8:
print '#ifdef PIPE_ARCH_BIG_ENDIAN'
print ' pixel.value = util_bswap%u(pixel.value);' % format.block_size()
print '#endif'
elif src_channel.type == SIGNED:
print ' int%u_t %s;' % (depth, src_channel.name)
- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
- print ' value = util_bswap%u(value);' % depth
- print '#endif'
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
# Compute the intermediate unshifted values
shift = 0
shift += dst_channel.size
- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
- print ' value = util_bswap%u(value);' % depth
- print '#endif'
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
print ' *(uint%u_t *)dst = value;' % depth