about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libpm.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libpm.c b/lib/libpm.c
index 78d941fa..b27b47d5 100644
--- a/lib/libpm.c
+++ b/lib/libpm.c
@@ -442,12 +442,20 @@ pm_maxvaltobits(int const maxval) {
     assert(false);
 }
 
+
+
 int
-pm_bitstomaxval(int const bits) {
-    return ( 1 << bits ) - 1;
+pm_bitstomaxval(int const bitCt) {
+
+    if (bitCt > 16)
+        pm_error("Bits per sample %u too large.  16 is maximum acceptable",
+                 bitCt);
+
+    return (1 << bitCt) - 1;
 }
 
 
+
 unsigned int PURE_FN_ATTR
 pm_lcm(unsigned int const x,
        unsigned int const y,