summaryrefslogtreecommitdiff
path: root/audio/quelcom/files/patch-lib::endian.hh
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2004-02-14 12:54:17 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2004-02-14 12:54:17 +0000
commit51505fe87160d96ee169096629f226ab1de71461 (patch)
tree3004c76cf66fa92cf01f8fa03dbcb9ff81517e42 /audio/quelcom/files/patch-lib::endian.hh
parent- Update to version 0.99.2 (diff)
- Update to version 0.4.0
PR: ports/62813 Submitted by: Ports Fury
Notes
Notes: svn path=/head/; revision=100910
Diffstat (limited to 'audio/quelcom/files/patch-lib::endian.hh')
-rw-r--r--audio/quelcom/files/patch-lib::endian.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/audio/quelcom/files/patch-lib::endian.hh b/audio/quelcom/files/patch-lib::endian.hh
new file mode 100644
index 000000000000..6643a15f57f4
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::endian.hh
@@ -0,0 +1,39 @@
+--- lib/endian.hh.orig Fri Feb 13 19:17:38 2004
++++ lib/endian.hh Fri Feb 13 19:17:38 2004
+@@ -0,0 +1,36 @@
++#ifndef _endian_hh_
++#define _endian_hh_
++
++/* quick and dirty endian conversion macros; applicable on big-endian
++ * architectures. This works okay on big- and little-endian machines, but
++ * not on middle-endian ones, should the "Linux on PDP-11" thing ever get
++ * past the April Fool's stage.
++ */
++
++#if __BYTE_ORDER == __BIG_ENDIAN
++
++static inline u_int16_t letohs(u_int16_t n) { return (n<<8)|(n>>8); }
++static inline u_int32_t letohl(u_int32_t n) {
++ return (n<<24) | ((n&0xff00)<<8) | ((n&0xff0000)>>8) | (n>>24);
++}
++static inline u_int16_t htoles(u_int16_t n) { return letohs(n); }
++static inline u_int32_t htolel(u_int32_t n) { return letohl(n); }
++
++static inline int16_t letohs_s(int16_t n) {
++ unsigned char *p = (unsigned char *)&n, tmp;
++ tmp = p[0]; p[0] = p[1]; p[1] = tmp;
++ return n;
++}
++static inline int16_t htoles_s(int16_t n) { return letohs_s(n); }
++#elif __BYTE_ORDER == __LITTLE_ENDIAN
++static inline u_int16_t letohs(u_int16_t n) { return n; }
++static inline u_int32_t letohl(u_int32_t n) { return n; }
++static inline u_int16_t htoles(u_int16_t n) { return n; }
++static inline u_int32_t htolel(u_int32_t n) { return n; }
++
++static inline int16_t letohs_s(int16_t n) { return n; }
++static inline int16_t htoles_s(int16_t n) { return n; }
++#endif
++
++#endif
++