#error "N must be #defined"
#endif
+#include "symcat.h"
+
/* NOTE: See end of file for #undef */
#define unsigned_N XCONCAT2(unsigned_,N)
#define endian_t2h_N XCONCAT2(endian_t2h_,N)
#define endian_le2h_N XCONCAT2(endian_le2h_,N)
#define offset_N XCONCAT2(offset_,N)
+/* TAGS: endian_t2h_1 endian_t2h_2 endian_t2h_4 endian_t2h_8 endian_t2h_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
+/* TAGS: endian_h2t_1 endian_h2t_2 endian_h2t_4 endian_h2t_8 endian_h2t_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
+/* TAGS: swap_1 swap_2 swap_4 swap_8 swap_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
_SWAP_N(return,raw_in);
}
-
+/* TAGS: endian_h2be_1 endian_h2be_2 endian_h2be_4 endian_h2be_8 endian_h2be_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
+/* TAGS: endian_be2h_1 endian_be2h_2 endian_be2h_4 endian_be2h_8 endian_be2h_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
+/* TAGS: endian_h2le_1 endian_h2le_2 endian_h2le_4 endian_h2le_8 endian_h2le_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
+/* TAGS: endian_le2h_1 endian_le2h_2 endian_le2h_4 endian_le2h_8 endian_le2h_16 */
INLINE_SIM_ENDIAN\
(unsigned_N)
}
}
-
+/* TAGS: offset_1 offset_2 offset_4 offset_8 offset_16 */
INLINE_SIM_ENDIAN\
(void*)
-offset_N(unsigned_N *x,
- int sizeof_word,
- int word)
+offset_N (unsigned_N *x,
+ unsigned sizeof_word,
+ unsigned word)
{
char *in = (char*)x;
char *out;
- int offset = sizeof_word * word;
- ASSERT(offset + sizeof_word <= sizeof(unsigned_N));
- ASSERT(word < (sizeof_word / sizeof(unsigned_N)));
- ASSERT((sizeof(unsigned_N) % sizeof_word) == 0);
- if (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
- out = in + sizeof(unsigned_N) - offset;
- }
- else {
- out = in + offset;
- }
+ unsigned offset = sizeof_word * word;
+ ASSERT (offset + sizeof_word <= sizeof(unsigned_N));
+ ASSERT (word < (sizeof (unsigned_N) / sizeof_word));
+ ASSERT ((sizeof (unsigned_N) % sizeof_word) == 0);
+ if (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN)
+ {
+ out = in + sizeof (unsigned_N) - offset - sizeof_word;
+ }
+ else
+ {
+ out = in + offset;
+ }
return out;
}