python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Prevent consecutive read operations from memory in C from being optimized away
My goal is to iterate memory on a microcontroller in C, and do two consecutive read operations on each cell, testing if both are zero. I try to do this as follows:
volatile uint8_t* memory = MEMORY_ST...
Cramstyler
Votes: 0
Answers: 0
Optimizing away static variable / passing by reference
In this question Will a static variable always use up memory? it is stated that compilers are allowed to optimize away a static variable if the address is never taken, e.g. like following:
void f() {
...

tommsch
Votes: 0
Answers: 2
Bloated code generated for __builtin_popcnt when -mavx2 is on
For such a function, clang (and sometimes gcc in certain contexts that I cannot reproduce minimally) seems to generate bloated code when -mavx2 switch is on.
unsigned count(uint64_t *f) {
unsigned...
xiver77
Votes: 0
Answers: 1
Implementing SHLD/SHRD instructions in C
I'm trying to efficiently implement SHLD and SHRD instructions of x86 without using inline assembly.
uint32_t shld_UB_on_0(uint32_t a, uint32_t b, uint32_t c) {
return a << c | b >> 32...
xiver77
Votes: 0
Answers: 1