[Bf-blender-cvs] [b4bf6b9cc97] functions: remove pad_up function
Jacques Lucke
noreply at git.blender.org
Mon Feb 10 16:40:45 CET 2020
Commit: b4bf6b9cc9705c2cb8f32e5a9986bf769e4158eb
Author: Jacques Lucke
Date: Mon Feb 10 16:23:14 2020 +0100
Branches: functions
https://developer.blender.org/rBb4bf6b9cc9705c2cb8f32e5a9986bf769e4158eb
remove pad_up function
===================================================================
M source/blender/blenlib/BLI_math_base.h
M source/blender/blenlib/intern/math_base_inline.c
M source/blender/functions/intern/generic_tuple.cc
===================================================================
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index cf806161e88..4f841f75d3a 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -161,8 +161,6 @@ MINLINE unsigned int power_of_2_min_u(unsigned int x);
MINLINE unsigned int log2_floor_u(unsigned int x);
MINLINE unsigned int log2_ceil_u(unsigned int x);
-MINLINE unsigned int pad_up(unsigned int x, unsigned int alignment);
-
MINLINE int divide_round_i(int a, int b);
MINLINE int mod_i(int i, int n);
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 46c0550e42f..e2484c294b1 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -249,11 +249,6 @@ MINLINE unsigned int log2_ceil_u(unsigned int x)
}
}
-MINLINE unsigned int pad_up(unsigned int x, unsigned int alignment)
-{
- BLI_assert(is_power_of_2_i((int)alignment));
- return (x + alignment - 1) & ~(alignment - 1);
-}
/* rounding and clamping */
diff --git a/source/blender/functions/intern/generic_tuple.cc b/source/blender/functions/intern/generic_tuple.cc
index b7216362f13..b58a05be9d4 100644
--- a/source/blender/functions/intern/generic_tuple.cc
+++ b/source/blender/functions/intern/generic_tuple.cc
@@ -10,10 +10,11 @@ GenericTupleInfo::GenericTupleInfo(Vector<const CPPType *> types) : m_types(std:
for (const CPPType *type : m_types) {
uint size = type->size();
uint alignment = type->alignment();
+ uint alignment_mask = alignment - 1;
m_alignment = std::max(m_alignment, alignment);
- m_size__data = pad_up(m_size__data, alignment);
+ m_size__data = (m_size__data + alignment_mask) & ~alignment_mask;
m_offsets.append(m_size__data);
m_size__data += size;
More information about the Bf-blender-cvs
mailing list