File: endian.h

package info (click to toggle)
gramofile 1.6-11
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,436 kB
  • ctags: 1,125
  • sloc: ansic: 11,252; makefile: 60
file content (19 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*  Header file for endian.c          */
/*  Joshua Weage   gte855f@prism.gatech.edu  */

#ifndef _GETBIG
#define _GETBIG 1

#include <sys/types.h>

extern u_short SwapTwoBytes (u_short);
extern u_int32_t SwapFourBytes (u_int32_t);
extern sample_t SwapSample (sample_t);

/* macro to swap endianness of values in a sample_t with */
/* a few 32-bit operations -- very fast                  */
#define SWAPSAMPLEREF(s) *((uint32_t *)(s)) = \
	((*((uint32_t *)(s)) & 0xff00ff00) >> 8) | \
	((*((uint32_t *)(s)) & 0x00ff00ff) << 8)

#endif