shithub: sox

Download patch

ref: fddee7116afbb76f5d825e9609f45eaf4a9df708
parent: f09c4ff40d21f9447f7c26a7f4b7dbdd6aa696a5
author: leighsmith <leighsmith>
date: Fri May 30 14:10:05 EDT 2003

added definition of a 24 bit byte swapping function st_swap24()

--- a/src/misc.c
+++ b/src/misc.c
@@ -35,7 +35,7 @@
         "NONSENSE!",
         "bytes",
         "shorts",
-        "NONSENSE",
+        "24 bits",
         "longs",
         "NONSENSE",
         "NONSENSE",
@@ -287,6 +287,11 @@
 }
 
 #endif
+
+uint32_t st_swap24(uint32_t udw)
+{
+    return (udw >> 16) | (udw & 0xff00) | ((udw << 16) & 0xff0000L);
+}
 
 double st_swapd(double df)
 {
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -90,6 +90,7 @@
 uint32_t st_swapdw(uint32_t udw);
 float st_swapf(float f);
 #endif
+uint32_t st_swap24(uint32_t udw);
 double st_swapd(double d);
 
 /* util.c */