summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/sfendian.h24
2 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f4b95c..6fd0fda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
* src/common.h src/caf.c
Read the ALAC 'pakt' header and stash the values.
+ * src/sfendian.h
+ Add functions psf_put_be64() and psf_put_be32().
+
2013-02-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* doc/FAQ.html
diff --git a/src/sfendian.h b/src/sfendian.h
index 1087e2f..fedc4cc 100644
--- a/src/sfendian.h
+++ b/src/sfendian.h
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@@ -139,6 +139,28 @@ ENDSWAP_64 (uint64_t x)
#define BET2H_16_PTR(x) (((x) [0] << 8) + (x) [1])
#define BET2H_32_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8))
+static inline void
+psf_put_be64 (uint8_t *ptr, int offset, int64_t value)
+{
+ ptr [offset] = value >> 56 ;
+ ptr [offset + 1] = value >> 48 ;
+ ptr [offset + 2] = value >> 40 ;
+ ptr [offset + 3] = value >> 32 ;
+ ptr [offset + 4] = value >> 24 ;
+ ptr [offset + 5] = value >> 16 ;
+ ptr [offset + 6] = value >> 8 ;
+ ptr [offset + 7] = value ;
+} /* psf_put_be64 */
+
+static inline void
+psf_put_be32 (uint8_t *ptr, int offset, int32_t value)
+{
+ ptr [offset] = value >> 24 ;
+ ptr [offset + 1] = value >> 16 ;
+ ptr [offset + 2] = value >> 8 ;
+ ptr [offset + 3] = value ;
+} /* psf_put_be32 */
+
/*-----------------------------------------------------------------------------------------------
** Generic functions for performing endian swapping on integer arrays.
*/