1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-16 08:15:31 +00:00
Interlisp.maiko/inc/byteswapdefs.h
Nick Briggs d509224797 Add explicit cast to byte_swap_word to resolve implicit conversion issue
warning: implicit conversion loses integer precision: 'int' to 'unsigned short'
2022-08-15 14:43:32 -07:00

29 lines
1.2 KiB
C

#ifndef BYTESWAPDEFS_H
#define BYTESWAPDEFS_H 1
/****************************************************************/
/* */
/* swap halves of a single 4-byte word */
/* */
/****************************************************************/
static inline unsigned int swapx(unsigned int word) {
return (((word >> 16) & 0xffff) | ((word & 0xffff) << 16));
}
/****************************************************************/
/* */
/* Byte-swap a single 2-byte word */
/* */
/****************************************************************/
static inline unsigned short byte_swap_word(unsigned short word) {
return ((word >> 8) | (unsigned short)((word & 0xff) << 8));
}
void byte_swap_page(unsigned short *page, int wordcount);
void word_swap_page(unsigned short *page, int longwordcount);
void bit_reverse_region(unsigned short *top, int width, int height, int rasterwidth);
#ifdef RESWAPPEDCODESTREAM
unsigned int byte_swap_code_block(unsigned int *base);
#endif
#endif