aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2012-10-30 16:27:52 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2012-10-30 16:27:52 +0100
commitaa858cb43adf0ca33f8a2abd7ba5a0c1d86e8c06 (patch)
tree34d7111e1170f9283ba6da8377d703f8531ea6ab
parent90fcaf11cf2e2928527fdc9df0a49389000ce603 (diff)
add first_multiple helper function
-rw-r--r--Eigen/src/Core/util/Memory.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 69148703e..b03bc3701 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -470,6 +470,13 @@ static inline Index first_aligned(const Scalar* array, Index size)
}
}
+/** \internal Returns the smallest integer multiple of \a base and greater or equal to \a size
+ */
+template<typename Index>
+inline static Index first_multiple(Index size, Index base)
+{
+ return ((size+base-1)/base)*base;
+}
// std::copy is much slower than memcpy, so let's introduce a smart_copy which
// use memcpy on trivial types, i.e., on types that does not require an initialization ctor.