Skip to content

Commit 8e7227b

Browse files
committed
sndio: simpler endianness check
1 parent 07ceda7 commit 8e7227b

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

src/host/sndio/endian.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/host/sndio/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ extern crate libc;
22
extern crate sndio_sys;
33

44
mod adapters;
5-
mod endian;
65
mod runner;
76
use self::adapters::{input_adapter_callback, output_adapter_callback};
87
use self::runner::runner;
@@ -44,6 +43,12 @@ pub enum SndioError {
4443
BackendSpecific(BackendSpecificError),
4544
}
4645

46+
#[cfg(target_endian = "big")]
47+
const IS_LITTLE_ENDIAN: u32 = 0;
48+
49+
#[cfg(target_endian = "little")]
50+
const IS_LITTLE_ENDIAN: u32 = 1;
51+
4752
impl From<SndioError> for BuildStreamError {
4853
fn from(e: SndioError) -> BuildStreamError {
4954
match e {
@@ -216,10 +221,7 @@ impl InnerState {
216221
// Use I16 at 48KHz; mono playback & record
217222
par.bits = 16;
218223
par.sig = 1;
219-
par.le = match endian::get_endianness() {
220-
endian::Endian::BE => 0,
221-
endian::Endian::LE => 1,
222-
}; // Native byte order
224+
par.le = IS_LITTLE_ENDIAN; // Native byte order
223225
par.rchan = 1; // mono record
224226
par.pchan = 1; // mono playback
225227
par.rate = rate.0;

0 commit comments

Comments
 (0)