Skip to content

Instantly share code, notes, and snippets.

View Alcaro's full-sized avatar
🦭
I am the Walrus.

Alcaro

🦭
I am the Walrus.
View GitHub Profile
// Some of the below only turn red if inside a set of braces.
{
AbsoluteDeltaToDuration
AbsoluteDeltaToNanoseconds
AbsoluteToDuration
AbsoluteToNanoseconds
AcquireIconRef
AddAbsoluteToAbsolute
AddAtomic
AddAtomic16
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@Alcaro
Alcaro / a.s
Last active April 19, 2018 17:17
#run with:
# as --32 a.S -o a.o && ld -m elf_i386 a.o -o a.out && ./a.out; echo $?
.intel_syntax noprefix
.globl _start
_start:
vpbroadcastd %ymm0, DWORD PTR [p21] # requires AVX2
vpaddd %ymm0, %ymm0, %ymm0 # requires AVX2
loaded 391 bytes
computing suffix array
Direct sort of 194 b* suffixes
direct sort initial 16 bit sort time: 21 ms
direct sort time: 2 ms
Program received signal SIGSEGV, Segmentation fault.
0x00000000004075bb in maniscalco::msufsort::second_stage_its_right_to_left_pass_single_threaded (this=0x7fffffffce10) at src/library/msufsort/msufsort.cpp:800
800 auto precedingSymbol = precedingSuffix[0];
(gdb) bt full
Compiled with https://gcc.godbolt.org/ AVR gcc 4.5.3, flags -Os
void g(volatile int* q)
{
*q=0;
}
void h(volatile long* q)
{
*q=0;
}
Compiled with https://gcc.godbolt.org/ x86-64 gcc 4.8.2, flags -Os
void q(int* a, volatile int* b)
{
*a=0;
*b=1;
*a=2;
*b=3;
*a=4;
}
Compiled with https://gcc.godbolt.org/ x86-64 gcc 4.8.2, flags -Os
void q(volatile __int128 * a)
{
*a=0;
}
q(__int128 volatile*):
mov QWORD PTR [rdi], 0
mov QWORD PTR [rdi+8], 0
Compiled with https://gcc.godbolt.org/ ARM gcc 4.8.2, flags -Os
void q(int* a, volatile int* b)
{
*a=0;
*b=1;
*a=2;
*b=3;
*a=4;
}
Compiled with https://gcc.godbolt.org/ ARM gcc 4.8.2, flags -Os
void g(volatile int* p, volatile int* q)
{
*p=0;
*q=0;
}
void h(int* p, int* q)
{
*p=0;