memory-alignment Questions
3
According to https://isocpp.org/wiki/faq/dtors#placement-new
the address passed into placement-new has to be properly aligned. But the example it gives seems to contradict that.
char memory[sizeof...
Katiekatina asked 1/3, 2017 at 1:22
1
Solved
(Sorry in advance for not having managed to reduce my problem to a simple failing test case...)
I have faced issues with upgrading to GCC 6.3.0 to build our codebase (relevant flags: -O3 -m32).
S...
Punish asked 16/2, 2017 at 10:43
1
I'm aware of the alignment issue arising when using Eigen's types in conjunction with dynamic memory. Thus, I've decided to disable vectorization with Eigen::DontAlign in accord with this page, yet...
Enzymology asked 11/2, 2017 at 21:44
1
Given a void * to some storage, how to check whether it points to properly aligned storage without any implementation defined behavior?
Of course we have std::align, but is there a more effective ...
Prudhoe asked 7/2, 2017 at 15:14
1
The short question is that if I have a function that takes two vectors. One is input and the other is output (no alias). I can only align one of them, which one should I choose?
The longer version...
Roundshouldered asked 1/12, 2016 at 20:27
2
I'm looking at the explanation of aligned-alloc():
http://en.cppreference.com/w/c/memory/aligned_alloc
void *aligned_alloc( size_t alignment, size_t size );
"Allocate size bytes of uninitialized...
Sporulate asked 8/12, 2016 at 3:37
1
Solved
I am trying to get a clear picture of who (caller or callee) is reponsible of stack alignment. The case for 64-bit assembly is rather clear, that it is by caller.
Referring to System V AMD64 ABI, ...
Caput asked 28/10, 2016 at 14:22
2
Solved
I recently posted a question about unaligned memory access, but given the answer, I am a little lost. I often hear that "aligned memory access is far more efficient than unaligned access", bu...
Chrisoula asked 7/10, 2016 at 17:0
1
Solved
Consider the following code:
#include <iostream>
int main()
{
char* c = new char('a');
char ac[4] = {'a', 'b', 'c', 'd'};
unsigned long long int* u = reinterpret_cast<unsigned l...
Ingles asked 7/10, 2016 at 3:34
1
Solved
Since std::array does not allow changing its allocator, is there a way to ensure that the pointer to the data address is aligned?
For instance, in GNU g++ 4.8.4 and 6.1.0, the code below
#include...
Endocentric asked 20/8, 2016 at 21:26
1
Solved
In C++, it seems that for all integer types (int, long long int, std::uint16_t, ...) and for the floating point types, it is always sizeof(T) == alignof(T).
Is this compiler/platform-specific, or ...
Compliant asked 12/8, 2016 at 11:19
1
Solved
This is one of the most important reasons for me to use C/C++ in writing some classes of system software, but it's been nothing more than a compiler extension which happens to be very common.
Why i...
Dumdum asked 27/7, 2016 at 8:41
4
Solved
In my first example I have two bitfields using int64_t. When I compile and get the size of the class I get 8.
class Test
{
int64_t first : 40;
int64_t second : 24;
};
int main()
{
std::cout &l...
Trainband asked 12/7, 2016 at 17:54
8
Solved
Suppose I have a struct like this:
struct MyStruct
{
uint8_t var0;
uint32_t var1;
uint8_t var2;
uint8_t var3;
uint8_t var4;
};
This is possibly going to waste a bunch (well not a ton)...
Scoff asked 7/7, 2016 at 11:47
1
Solved
I read somewhere that before performing unaligned load or store next to page boundary (e.g. using _mm_loadu_si128 / _mm_storeu_si128 intrinsics), code should first check if whole vector (in this ca...
Goodwill asked 9/6, 2016 at 21:27
5
Solved
The SP_DEVICE_INTERFACE_DETAIL_DATA structure:
typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA {
DWORD cbSize;
TCHAR DevicePath[ANYSIZE_ARRAY];
} SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INT...
Osage asked 23/5, 2012 at 22:13
5
Solved
I've been reading this article about atomic operations, and it mentions 32-bit integer assignment being atomic on x86, as long as the variable is naturally aligned.
Why does natural alignment assur...
Eridanus asked 14/4, 2016 at 13:38
8
Solved
Admittedly I don't get it. Say you have a memory with a memory word of length of 1 byte. Why can't you access a 4 byte long variable in a single memory access on an unaligned address(i.e. not divis...
Keelby asked 19/12, 2008 at 15:18
1
Solved
While reading this I was amazed on what a certain level of metaprogramming can do for your class layout. I must admit that I don't fully grasp what's the proposed optimal layout, if I had to state ...
Pastille asked 26/3, 2016 at 18:42
3
Solved
C++11 introduced the alignas specifier to specify the alignment of a variable, and the alignof operator to query the default alignment of a type. However, I don't see any way to get the alignment o...
Ganley asked 25/3, 2016 at 9:5
3
Solved
I'm trying to understand how unaligned memory access (UMA) works on modern processors (namely x86-64 and ARM architectures). I get that I might run into problems with UMA ranging from performance d...
Sihon asked 11/5, 2014 at 14:46
1
Solved
I have a struct of 4 fields of types that come from template parameters:
template <typename T1, typename T2, typename T3, typename T4>
struct __attribute__((aligned(8))) four_tuple {
typede...
Pinnatifid asked 8/1, 2016 at 7:28
1
Sorry for the confusing title, but I can't think of a better way to explain it.
While browsing the source code of BitConverter recently, I came across a strange segment of code:
public static uns...
Pandybat asked 26/8, 2015 at 1:7
1
Solved
Why is the default alignment 8 byte for int64_t (e.g. long long) in 32 bit x86 ABIs? 4 byte alignment would appear to be fine, because it can only be accessed as two 4B halves.
Botzow asked 29/12, 2015 at 4:27
4
So far thought it is, but after I learned that the compiler may pad data to align it for architecture requirements for example I'm in doubt. So I wonder if a char[4][3] has the same memory layout a...
Olecranon asked 13/12, 2015 at 12:8
© 2022 - 2024 — McMap. All rights reserved.