Commit 67c97f6a authored by Jai Menon's avatar Jai Menon Committed by Adam Procter

CPU: Implement workaround for GCC < 5 (#518)

parent 607bcbc4
......@@ -56,7 +56,16 @@ runtime::cpu::CPUTensorView::CPUTensorView(const ngraph::element::Type& element_
throw ngraph_error("Error allocating CPU Tensor View memory");
}
buffer = static_cast<char*>(ptr);
// GCC major versions below 5 do not implement C++11 std::align
#if !defined(__GNUC__) || __GNUC__ >= 5
std::align(BufferAlignment, buffer_size, ptr, allocation_size);
#else
ptr = static_cast<char*>(ptr) + (BufferAlignment - 1);
ptr = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) &
~(uintptr_t(BufferAlignment - 1)));
#endif
aligned_buffer = static_cast<char*>(ptr);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment