memory-alignment Questions

4

I will list exactly what I do not understand, and show you the parts I can not understand as well. First off, The .Align Directive .align integer, pad. The .align directive causes the next da...
Archiplasm asked 25/6, 2013 at 19:42

1

Solved

On GCC specifically (that is, compiling both with GCC), what are the differences between the way the following two work? struct foo1 { char a; int b; } __attribute__((__packed__, aligned(n) )); ...
Lampoon asked 30/10, 2015 at 13:33

4

Solved

I was reading a article about data types alignment in memory(here) and I am unable to understand one point i.e. Note that a double variable will be allocated on 8 byte boundary on 32 bit machin...
Adventurism asked 6/6, 2012 at 11:16

2

Solved

Given a POD-struct (in C++03) or a standard layout type (in C++11), with all members having a fundamental alignment requirement, is it true that every member is guaranteed to be aligned according t...
Eec asked 21/9, 2015 at 16:20

3

Solved

I am having alignment issue while using ymm registers, with some snippets of code that seems fine to me. Here is a minimal working example: #include <iostream> #include <immintrin.h> ...
Past asked 16/9, 2015 at 14:57

1

Solved

While working on my compiler I got this error: Program received signal SIGSEGV, Segmentation fault. __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33 How do I ...
Bluish asked 11/9, 2015 at 14:38

2

Solved

I would like to use C++11's std::aligned_alloc, but unfortunately it isn't available with Microsoft Visual Studio 2013. I'm considering, intsead, implementing aligned_alloc on my own. How should ...

2

Solved

It used to be that ARM processors were unable to properly handle unaligned memory access (ARMv5 and below). Something like u32 var32 = *(u32*)ptr; would just fail (raise exception) if ptr was not p...
Schumacher asked 18/8, 2015 at 3:9

2

Solved

I would like to create a struct that has a certain alignment. I would like to use the same struct definition for both GCC and VisualC++ compilers. In VisualC++, one typically does this: __declsp...
Solar asked 25/10, 2011 at 21:4

5

I'm writing a decoder for a binary protocol (Javad GRIL protocol). It consists of about a hundred messages, with data in the following format: struct MsgData { uint8_t num; float x, y, z; uint8...
Sportsmanship asked 20/1, 2011 at 15:55

1

Solved

I'm trying to work with AVX instructions and windows 64bit. I'm comfortable with g++ compiler so I've been using that, however, there is a big bug described reported here and very rough solutions w...
Alonzoaloof asked 19/6, 2015 at 0:53

1

Solved

I wrote some code with static arrays and it vectorizes just fine. float data[1024] __attribute__((aligned(16))); I would like to make the arrays dynamically allocated. I tried doing something li...
Scutum asked 17/6, 2015 at 1:8

4

Does Visual Studio C++ 2008/2010 support _mm_malloc officially? It is defined in malloc.h but I can't find its description in the MSDN library.
Tardigrade asked 22/7, 2010 at 6:28

4

Upgrading an application from 32 to 64 bit increases the pointer size and the memory footprint of objects. I am looking for methods to reduce the memory footprint of objects as much as possible. F...
Soloma asked 3/4, 2012 at 7:48

2

When defining structs in C, there are considerations regarding padding, if struct size is a concern, its common to re-arrange the values to avoid padding. (see: Structure padding and packing) My q...
Arroba asked 21/5, 2015 at 2:42

2

Solved

My question is rather simple; Does the alignas specifier work with 'new'? That is, if a struct is defined to be aligned, will it be aligned when allocated with new?
Mosul asked 19/3, 2013 at 22:41

1

Solved

I often use compiler-based vectorization, e.g., for AVX. I am trying to come up with a cleaner way without relying on compiler-based extensions (such as Intel's #pragma vector aligned) by relying o...
Scuppernong asked 4/5, 2015 at 7:12

1

Solved

So I have the following minimized C11 code that defines a struct containing a uint16_t (which means the struct it should be aligned to 2 bytes) and I want to cast a char buffer to a pointer to that...
Metaplasia asked 14/2, 2015 at 14:7

3

Solved

I'm doing a project on an ARM Cortex M0, which does not support unaligned(by 4bytes) access, and I'm trying to optimize the speed of operations on unaligned data. I'm storing Bluetooth Low Energy...
Prickly asked 24/4, 2015 at 20:5

1

Solved

I frequently need to align the start of a dynamic array to a 16, 32, or 64 Byte boundary for vectorization, e.g., for SSE, AVX, AVX-512. I am looking for a transparent and safe way to use this in c...
Chloromycetin asked 2/4, 2015 at 9:57

1

Solved

The way I'm currently doing it (I'd prefer to get rid of the memcpy call): uint64_t integer; uint8_t string[8]; ... memcpy(&integer, &string, 8); //or swap the parameters Assuming intege...
Gluteus asked 22/3, 2015 at 13:41

2

Solved

To make it specific, I only want to know why on my 64 bit mac, the Swift compiler says the alignment of some types like Float80 is 16. To check the memory alignment requirement of a type, I use the...
Decidua asked 6/3, 2015 at 11:56

3

Solved

The book The C Programming Language talks about "the most restrictive type" in section 8.7, Example — A Storage Allocator: Although machines vary, for each machine there is a most restrict...
Andromeda asked 7/3, 2015 at 14:46

2

Solved

Is a misaligned load due a a cast from void* undefined behavior? Here's what I am seeing with Clang and its sanitizers: bufhelp.h:146:29: runtime error: load of misaligned address 0x7fff04fdd0e...
Safar asked 6/3, 2015 at 6:17

2

Solved

I am learning C. In C Primer Plus, I saw an bit field example as follows: struct box_props { bool opaque : 1; unsigned int fill_color : 3; unsigned int : 4; bool show_border : 1; unsigned int...
Olivenite asked 4/3, 2015 at 11:51

© 2022 - 2024 — McMap. All rights reserved.