aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-01 19:29:55 +0100
committerMax Kellermann <max@duempel.org>2013-12-01 19:32:48 +0100
commit28ad79c97ab273d5077847cc81ca969c63474219 (patch)
tree292d6ab548cdda2936a4e3e7636796ed2c0c3e47 /src/pcm
parent7661ad6653eb69b1237dc815f1d032afd644e9c3 (diff)
downloadmpd-28ad79c97ab273d5077847cc81ca969c63474219.tar.gz
mpd-28ad79c97ab273d5077847cc81ca969c63474219.tar.xz
mpd-28ad79c97ab273d5077847cc81ca969c63474219.zip
pcm/Traits: add typedef long_type
Diffstat (limited to 'src/pcm')
-rw-r--r--src/pcm/Traits.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pcm/Traits.hxx b/src/pcm/Traits.hxx
index b102b41ab..58a61c9c5 100644
--- a/src/pcm/Traits.hxx
+++ b/src/pcm/Traits.hxx
@@ -51,6 +51,13 @@ struct SampleTraits<SampleFormat::S8> {
typedef const value_type *const_pointer_type;
/**
+ * A "long" type that is large and accurate enough for
+ * arithmetic without risking an (integer) overflow or
+ * (floating point) precision loss.
+ */
+ typedef int long_type;
+
+ /**
* The size of one sample in bytes.
*/
static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
@@ -68,6 +75,8 @@ struct SampleTraits<SampleFormat::S16> {
typedef value_type *pointer_type;
typedef const value_type *const_pointer_type;
+ typedef int long_type;
+
static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
static constexpr unsigned BITS = sizeof(value_type) * 8;
};
@@ -78,6 +87,8 @@ struct SampleTraits<SampleFormat::S32> {
typedef value_type *pointer_type;
typedef const value_type *const_pointer_type;
+ typedef int64_t long_type;
+
static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
static constexpr unsigned BITS = sizeof(value_type) * 8;
};
@@ -88,6 +99,8 @@ struct SampleTraits<SampleFormat::S24_P32> {
typedef value_type *pointer_type;
typedef const value_type *const_pointer_type;
+ typedef int long_type;
+
static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
static constexpr unsigned BITS = 24;
};