void SwappingEndian::set(u2& x, u2 y) { x = bswap_16(y); } void SwappingEndian::set(u4& x, u4 y) { x = bswap_32(y); } void SwappingEndian::set(u8& x, u8 y) { x = bswap_64(y); } void SwappingEndian::set(s2& x, s2 y) { x = bswap_16(y); } void SwappingEndian::set(s4& x, s4 y) { x = bswap_32(y); } void SwappingEndian::set(s8& x, s8 y) { x = bswap_64(y); }
SwappingEndian SwappingEndian::_swapping;
Endian* Endian::get_handler(bool big_endian) { // If requesting little endian on a little endian machine or // big endian on a big endian machine use native handler if (big_endian == is_big_endian()) { return NativeEndian::get_native();
} else { // Use swapping handler. return SwappingEndian::get_swapping();
}
}
// Return a platform u2 from an array in which Big Endian is applied.
u2 Endian::get_java(u1* x) { return (u2) (x[0]<<8 | x[1]);
}
// Add a platform u2 to the array as a Big Endian u2 void Endian::set_java(u1* p, u2 x) {
p[0] = (x >> 8) & 0xff;
p[1] = x & 0xff;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.