Skip to content

Instantly share code, notes, and snippets.

View Themaister's full-sized avatar

Hans-Kristian Arntzen Themaister

View GitHub Profile
#if __SSE2__
#include <emmintrin.h>
// There's no equivalent in libc, you'd think so ... std::mismatch exists, but it's not optimized at all. :(
static unsigned find_mismatch(const uint32_t *a, const uint32_t *b, unsigned samples)
{
unsigned i;
unsigned sse_samples = samples & ~3;
for (i = 0; i < sse_samples; i += 4)
{
__m128i v0 = _mm_loadu_si128((const __m128i*)(a + i));
// Compile: g++ -o dark.so -shared dark.c -std=c99 -O3 -Wall -pedantic -fPIC
#include "softfilter.h"
#include <stdlib.h>
static unsigned impl_input_fmts(void)
{
return SOFTFILTER_FMT_XRGB8888;
}
// Compile: gcc -o dark.so -shared dark.c -std=c99 -O3 -Wall -pedantic -fPIC
#include "softfilter.h"
#include <stdlib.h>
static unsigned impl_input_fmts(void)
{
return SOFTFILTER_FMT_XRGB8888;
}
#ifndef LIBSNES_HPP
#define LIBSNES_HPP
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
///////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<shader language="GLSL">
<vertex><![CDATA[
uniform vec2 rubyTextureSize;
void main() {
float x = 0.5 * (1.0 / rubyTextureSize.x);
float y = 0.5 * (1.0 / rubyTextureSize.y);
vec2 dg1 = vec2( x, y);
vec2 dg2 = vec2(-x, y);
test.o: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
//clang-fails.c:
#include <stdio.h>
#include <stdio.h>
int main (void) {
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 83 ec 20 sub $0x20,%rsp
8: 48 b8 c0 bd f0 ff ff movabs $0xfffffffffff0bdc0,%rax
f: ff ff ff
12: f2 48 0f 2a c0 cvtsi2sd %rax,%xmm0
17: 48 b8 00 b8 17 fe ff movabs $0xfffffffffe17b800,%rax
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: bf 00 00 00 00 mov $0x0,%edi
9: e8 00 00 00 00 callq e <main+0xe>
e: bf 00 00 00 00 mov $0x0,%edi
13: e8 00 00 00 00 callq 18 <main+0x18>
18: bf 00 00 00 00 mov $0x0,%edi
1d: e8 00 00 00 00 callq 22 <main+0x22>
22: 31 c0 xor %eax,%eax
#!/bin/sh
die()
{
echo "Error: $1"
exit 1
}
if [ -z "$1" ]; then
die "Need at least one argument"
.include "header.inc"
.include "initsnes.asm"
.equ BGColorL $0000
.equ BGColorH $0001
; Some handy HW addresses we're using.
.equ JoypadState $4212
.equ JoypadStatus $4218