aboutsummaryrefslogtreecommitdiffstats
path: root/src/Vivant/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Vivant/Common.hs')
-rw-r--r--src/Vivant/Common.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Vivant/Common.hs b/src/Vivant/Common.hs
new file mode 100644
index 0000000..fd90233
--- /dev/null
+++ b/src/Vivant/Common.hs
@@ -0,0 +1,9 @@
+module Vivant.Common
+ (vectorSize)
+where
+
+import qualified Data.Vector.Storable as V
+import Foreign.Storable (sizeOf)
+
+vectorSize :: (Num b, V.Storable a) => V.Vector a -> b
+vectorSize array = fromIntegral $ V.length array * sizeOf (1.0 :: Float)