#ifdef _is_F_endian_little
// Big Endian.
if (packet->control & F_fss_simple_packet_endian_d) {
- packet->size = ((uint8_t) buffer.string[1]);
- packet->size += ((uint8_t) buffer.string[2]) << 8;
- packet->size += ((uint8_t) buffer.string[3]) << 16;
- packet->size += ((uint8_t) buffer.string[4]) << 24;
+ packet->size = (uint32_t) ((uint8_t) buffer.string[1]);
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4])) << 24;
}
// Little Endian.
else {
- packet->size = ((uint8_t) buffer.string[1]) << 24;
- packet->size += ((uint8_t) buffer.string[2]) << 16;
- packet->size += ((uint8_t) buffer.string[3]) << 8;
- packet->size += ((uint8_t) buffer.string[4]);
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1])) << 24;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4]));
}
#else
// Big Endian.
if (packet->control & F_fss_simple_packet_endian_d) {
- packet->size = ((uint8_t) buffer.string[1]) << 24;
- packet->size += ((uint8_t) buffer.string[2]) << 16;
- packet->size += ((uint8_t) buffer.string[3]) << 8;
- packet->size += ((uint8_t) buffer.string[4]);
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1])) << 24;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4]));
}
// Little Endian.
else {
- packet->size = ((uint8_t) buffer.string[1]);
- packet->size += ((uint8_t) buffer.string[2]) << 8;
- packet->size += ((uint8_t) buffer.string[3]) << 16;
- packet->size += ((uint8_t) buffer.string[4]) << 24;
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1]));
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4])) << 24;
}
#endif // _is_F_endian_little
#ifdef _is_F_endian_little
// Big Endian.
if (packet->control & F_fss_simple_packet_endian_d) {
- packet->size = ((uint8_t) buffer.string[1]);
- packet->size += ((uint8_t) buffer.string[2]) << 8;
- packet->size += ((uint8_t) buffer.string[3]) << 16;
- packet->size += ((uint8_t) buffer.string[4]) << 24;
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1]));
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4])) << 24;
}
// Little Endian.
else {
- packet->size = ((uint8_t) buffer.string[1]) << 24;
- packet->size += ((uint8_t) buffer.string[2]) << 16;
- packet->size += ((uint8_t) buffer.string[3]) << 8;
- packet->size += ((uint8_t) buffer.string[4]);
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1])) << 24;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4]));
}
#else
// Big Endian.
if (packet->control & F_fss_simple_packet_endian_d) {
- packet->size = ((uint8_t) buffer.string[1]) << 24;
- packet->size += ((uint8_t) buffer.string[2]) << 16;
- packet->size += ((uint8_t) buffer.string[3]) << 8;
- packet->size += ((uint8_t) buffer.string[4]);
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1])) << 24;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4]));
}
// Little Endian.
else {
- packet->size = ((uint8_t) buffer.string[1]);
- packet->size += ((uint8_t) buffer.string[2]) << 8;
- packet->size += ((uint8_t) buffer.string[3]) << 16;
- packet->size += ((uint8_t) buffer.string[4]) << 24;
+ packet->size = ((uint32_t) ((uint8_t) buffer.string[1]));
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[2])) << 8;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[3])) << 16;
+ packet->size += ((uint32_t) ((uint8_t) buffer.string[4])) << 24;
}
#endif // _is_F_endian_little
#define F_utf_char_mask_char_3_be_d 0x0000ff00 // 0000 0000, 0000 0000, 1111 1111, 0000 0000
#define F_utf_char_mask_char_4_be_d 0x000000ff // 0000 0000, 0000 0000, 0000 0000, 1111 1111
- #define macro_f_utf_char_t_to_char_1_be(sequence) (((sequence) & F_utf_char_mask_char_1_be_d) >> 24) // Grab first byte.
- #define macro_f_utf_char_t_to_char_2_be(sequence) (((sequence) & F_utf_char_mask_char_2_be_d) >> 16) // Grab second byte.
- #define macro_f_utf_char_t_to_char_3_be(sequence) (((sequence) & F_utf_char_mask_char_3_be_d) >> 8) // Grab third byte.
- #define macro_f_utf_char_t_to_char_4_be(sequence) ((sequence) & F_utf_char_mask_char_4_be_d) // Grab fourth byte.
+ #define macro_f_utf_char_t_to_char_1_be(sequence) ((uint32_t) ((sequence) & F_utf_char_mask_char_1_be_d) >> 24) // Grab first byte.
+ #define macro_f_utf_char_t_to_char_2_be(sequence) ((uint32_t) ((sequence) & F_utf_char_mask_char_2_be_d) >> 16) // Grab second byte.
+ #define macro_f_utf_char_t_to_char_3_be(sequence) ((uint32_t) ((sequence) & F_utf_char_mask_char_3_be_d) >> 8) // Grab third byte.
+ #define macro_f_utf_char_t_to_char_4_be(sequence) ((uint32_t) (sequence) & F_utf_char_mask_char_4_be_d) // Grab fourth byte.
- #define macro_f_utf_char_t_from_char_1_be(sequence) (((sequence) << 24) & F_utf_char_mask_char_1_be_d) // Shift to first byte.
- #define macro_f_utf_char_t_from_char_2_be(sequence) (((sequence) << 16) & F_utf_char_mask_char_2_be_d) // Shift to second byte.
- #define macro_f_utf_char_t_from_char_3_be(sequence) (((sequence) << 8) & F_utf_char_mask_char_3_be_d) // Shift to third byte.
- #define macro_f_utf_char_t_from_char_4_be(sequence) ((sequence) & F_utf_char_mask_char_4_be_d) // Shift to fourth byte.
+ #define macro_f_utf_char_t_from_char_1_be(sequence) ((((uint32_t) (sequence)) << 24) & F_utf_char_mask_char_1_be_d) // Shift to first byte.
+ #define macro_f_utf_char_t_from_char_2_be(sequence) ((((uint32_t) (sequence)) << 16) & F_utf_char_mask_char_2_be_d) // Shift to second byte.
+ #define macro_f_utf_char_t_from_char_3_be(sequence) ((((uint32_t) (sequence)) << 8) & F_utf_char_mask_char_3_be_d) // Shift to third byte.
+ #define macro_f_utf_char_t_from_char_4_be(sequence) (((uint32_t) (sequence)) & F_utf_char_mask_char_4_be_d) // Shift to fourth byte.
// Little Endian.
#define F_utf_char_mask_byte_1_le_d 0x000000ff // 0000 0000, 0000 0000, 0000 0000, 1111 1111
#define F_utf_char_mask_char_3_le_d 0x00ff0000 // 0000 0000, 1111 1111, 0000 0000, 0000 0000
#define F_utf_char_mask_char_4_le_d 0xff000000 // 1111 1111, 0000 0000, 0000 0000, 0000 0000
- #define macro_f_utf_char_t_to_char_1_le(sequence) ((sequence) & F_utf_char_mask_char_1_le_d) // Grab first byte.
- #define macro_f_utf_char_t_to_char_2_le(sequence) (((sequence) & F_utf_char_mask_char_2_le_d) >> 8) // Grab second byte.
- #define macro_f_utf_char_t_to_char_3_le(sequence) (((sequence) & F_utf_char_mask_char_3_le_d) >> 16) // Grab third byte.
- #define macro_f_utf_char_t_to_char_4_le(sequence) (((sequence) & F_utf_char_mask_char_4_le_d) >> 24) // Grab fourth byte.
+ #define macro_f_utf_char_t_to_char_1_le(sequence) ((uint32_t) ((sequence) & F_utf_char_mask_char_1_le_d)) // Grab first byte.
+ #define macro_f_utf_char_t_to_char_2_le(sequence) (((uint32_t) ((sequence) & F_utf_char_mask_char_2_le_d)) >> 8) // Grab second byte.
+ #define macro_f_utf_char_t_to_char_3_le(sequence) (((uint32_t) ((sequence) & F_utf_char_mask_char_3_le_d)) >> 16) // Grab third byte.
+ #define macro_f_utf_char_t_to_char_4_le(sequence) (((uint32_t) ((sequence) & F_utf_char_mask_char_4_le_d)) >> 24) // Grab fourth byte.
- #define macro_f_utf_char_t_from_char_1_le(sequence) ((sequence) & F_utf_char_mask_char_1_le_d) // Shift to first byte.
- #define macro_f_utf_char_t_from_char_2_le(sequence) (((sequence) << 8) & F_utf_char_mask_char_2_le_d) // Shift to second byte.
- #define macro_f_utf_char_t_from_char_3_le(sequence) (((sequence) << 16) & F_utf_char_mask_char_3_le_d) // Shift to third byte.
- #define macro_f_utf_char_t_from_char_4_le(sequence) (((sequence) << 24) & F_utf_char_mask_char_4_le_d) // Shift to fourth byte.
+ #define macro_f_utf_char_t_from_char_1_le(sequence) (((uint32_t) (sequence) & F_utf_char_mask_char_1_le_d)) // Shift to first byte.
+ #define macro_f_utf_char_t_from_char_2_le(sequence) ((((uint32_t) (sequence) << 8) & F_utf_char_mask_char_2_le_d)) // Shift to second byte.
+ #define macro_f_utf_char_t_from_char_3_le(sequence) ((((uint32_t) (sequence) << 16) & F_utf_char_mask_char_3_le_d)) // Shift to third byte.
+ #define macro_f_utf_char_t_from_char_4_le(sequence) ((((uint32_t) (sequence) << 24) & F_utf_char_mask_char_4_le_d)) // Shift to fourth byte.
#define F_utf_char_mask_byte_1_d F_utf_char_mask_byte_1_be_d
#define F_utf_char_mask_byte_2_d F_utf_char_mask_byte_2_be_d