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
--- a/libretro-v2.h
+++ b/libretro-v2.h
@@ -1890,18 +1890,32 @@ void retro_reset(struct retro_core_data *core_handle);
*/
void retro_run(struct retro_core_data *core_handle);
+enum retro_serialize_type {
+ RETRO_SERIALIZE_TYPE_SRAM = 0, /* This refers to save data. */
+ RETRO_SERIALIZE_TYPE_SAVESTATE, /* This refers to all internal core state. */
+
<!DOCTYPE html><html lang="en" data-cast-api-enabled="true"><head><script>var ytcsi = {gt: function(n) {n = (n || '') + 'data_';return ytcsi[n] || (ytcsi[n] = {tick: {},span: {},info: {}});},tick: function(l, t, n) {ytcsi.gt(n).tick[l] = t || +new Date();},span: function(l, s, e, n) {ytcsi.gt(n).span[l] = (e ? e : +new Date()) - ytcsi.gt(n).tick[s];},setSpan: function(l, s, n) {ytcsi.gt(n).span[l] = s;},info: function(k, v, n) {ytcsi.gt(n).info[k] = v;},setStart: function(s, t, n) {ytcsi.info('yt_sts', s, n);ytcsi.tick('_start', t, n);}};(function(w, d) {ytcsi.perf = w.performance || w.mozPerformance ||w.msPerformance || w.webkitPerformance;ytcsi.setStart('dhs', ytcsi.perf ? ytcsi.perf.timing.responseStart : null);var isPrerender = (d.visibilityState || d.webkitVisibilityState) == 'prerender';var vName = d.webkitVisibilityState ? 'webkitvisibilitychange' : 'visibilitychange';if (isPrerender) {ytcsi.info('prerender', 1);var startTick = function() {ytcsi.setStart('dhs');d.removeEventListener(vName, startTick);}
assume DRAM is constant endian
u8[] DRAM = {1,2,3,4}
big endian
pix = *(int32_t *)(DRAM + addr); - pix = 1234
argb[1 ^ BYTE_ADDR_XOR] = (unsigned char)(pix >> 24); - argb[1] = 1
argb[2 ^ BYTE_ADDR_XOR] = (unsigned char)(pix >> 16); - argb[2] = 2
argb[3 ^ BYTE_ADDR_XOR] = (unsigned char)(pix >> 8); - argb[3] = 3
argb[0 ^ BYTE_ADDR_XOR] = (unsigned char)(pix >> 0); - argb[0] = 4, argb[]={4,1,2,3}
scanline[i] = *(int32_t *)(argb); - scanline = 4123
Byte shenanigans, little endian
uint32_t p(uint32_t pix) { uint8_t argb[4]; argb[3-1]=pix>>24; argb[3-2]=pix>>16; argb[3-3]=pix>>8; argb[3-0]=pix>>0; return *(uint32_t*)argb; }
_Z1pj: # edi=1234
mov eax, edi # edi=1234 eax=1234
mov edx, edi # edi=1234 eax=1234 edx=1234
shr eax, 24 # edi=1234 eax=0001 edx=1234
shr edx, 16 # edi=1234 eax=0001 edx=0012
sal eax, 16 # edi=1234 eax=0100 edx=0012
mov ah, dl # edi=1234 eax=0120 edx=0012
mov edx, edi # edi=1234 eax=0120 edx=1234
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;
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/ 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/ 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/ AVR gcc 4.5.3, flags -Os
void g(volatile int* q)
{
*q=0;
}
void h(volatile long* q)
{
*q=0;
}
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