提交 ea916c84 编写于 作者: L liaogang

Fix: alignment metric

上级 21b7915d
...@@ -24,7 +24,7 @@ limitations under the License. */ ...@@ -24,7 +24,7 @@ limitations under the License. */
#include <unordered_map> #include <unordered_map>
inline bool is_aligned(void const *p, const size_t n) { inline bool is_aligned(void const *p, const size_t n) {
return 0 == (reinterpret_cast<uintptr_t>(p) % n); return 0 == (reinterpret_cast<uintptr_t>(p) & 0x3);
} }
size_t align(size_t size, paddle::platform::CPUPlace place) { size_t align(size_t size, paddle::platform::CPUPlace place) {
...@@ -34,8 +34,6 @@ size_t align(size_t size, paddle::platform::CPUPlace place) { ...@@ -34,8 +34,6 @@ size_t align(size_t size, paddle::platform::CPUPlace place) {
return remaining == 0 ? size : size + (alignment - remaining); return remaining == 0 ? size : size + (alignment - remaining);
} }
void update_size(size_t &total_size, const size_t size) {}
TEST(BuddyAllocator, CPUAllocation) { TEST(BuddyAllocator, CPUAllocation) {
void *p = nullptr; void *p = nullptr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册