changeset 19590:d7057df2968e

use existing function to determine endianness in audiodevinfo.cc * audiodevinfo.cc (is_big_endian): Delete. (octave_play_callback, portaudio_play_callback): Use oct_mach_info::words_big_endian instead of local big_endian function.
author John W. Eaton <jwe@octave.org>
date Fri, 09 Jan 2015 13:25:52 -0500
parents 9bd2f0a07c95
children 182abae666ae
files libinterp/dldfcn/audiodevinfo.cc
diffstat 1 files changed, 4 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/audiodevinfo.cc	Fri Jan 09 13:19:50 2015 -0500
+++ b/libinterp/dldfcn/audiodevinfo.cc	Fri Jan 09 13:25:52 2015 -0500
@@ -30,6 +30,8 @@
 #include <string>
 #include <vector>
 
+#include "mach-info.h"
+
 #include "defun-dld.h"
 #include "error.h"
 #include "gripes.h"
@@ -515,17 +517,6 @@
 DEFINE_OCTAVE_ALLOCATOR (audioplayer);
 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (audioplayer, "audioplayer", "audioplayer");
 
-int
-is_big_endian (void)
-{
-  union
-    {
-      uint32_t i;
-      char c[4];
-    } bint = { 0x01020304 };
-  return bint.c[0] == 1;
-}
-
 static int
 octave_play_callback (const void *, void *output, unsigned long frames,
                       const PaStreamCallbackTimeInfo *,
@@ -603,7 +594,7 @@
       {
         static double scale_factor = pow (2.0, 23) - 1.0;
 
-        static int big_endian = is_big_endian ();
+        static int big_endian = oct_mach_info::words_big_endian ();
 
         uint8_t *buffer = static_cast<uint8_t *> (output);
 
@@ -719,7 +710,7 @@
           {
             static double scale_factor = pow (2.0, 23) - 1.0;
 
-            static int big_endian = is_big_endian ();
+            static int big_endian = oct_mach_info::words_big_endian ();
 
             uint8_t *buffer = static_cast<uint8_t *> (output);