Skip to content

Instantly share code, notes, and snippets.

View phire's full-sized avatar

Scott Mansell phire

View GitHub Profile
@phire
phire / gist:0b3a17e9bcad63211417
Created August 27, 2015 02:17
Dolphin backtrace
ntdll.dll!RtlReportCriticalFailure() Unknown
ntdll.dll!RtlpHeapHandleError() Unknown
ntdll.dll!RtlpLogHeapFailure() Unknown
> ntdll.dll!RtlpLowFragHeapFree() Unknown
ntdll.dll!RtlFreeHeap() Unknown
msvcr120.dll!free(void * pBlock) Line 51 C
Dolphin.exe!std::vector<unsigned int,std::allocator<unsigned int> >::_Reallocate(unsigned __int64 _Count) Line 1605 C++
Dolphin.exe!HotkeyManager::GetInput(HotkeyStatus * const kb) Line 240 C++
Dolphin.exe!CFrame::PollHotkeys(wxTimerEvent & event) Line 1290 C++
Dolphin.exe!wxAppConsoleBase::CallEventHandler(wxEvtHandler * handler, wxEventFunctor & functor, wxEvent & event) Line 624 C++
mov vpm, qpu_num
mov vpm, elem_num
# Configure vpm write to memory
ldi vw_setup, vw_setup0(2, 16)
ldi vw_setup, vw_setup1(0, 0)
# Trigger transfer to destination in memory (address is from uniforms)
nop; mov vw_addr, unif
.global entry
entry:
nop
nop
mov r0, vary; mov r3.8d, 1.0
add rb0, r0, r5; mov r1, vary
add rb1, r1, r5; mov r2, vary
add rb2, r2, r5; mov r3.8a, rb0
nop; mov r3.8b, rb1
@phire
phire / Makefile
Created August 12, 2014 04:37
segfault benchmark.
benchmark: main.cpp
g++ main.cpp -O3 -g -std=c++11 -o benchmark
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <algorithm>
#include <deque>
#include "Core/PowerPC/Pipeline.h"
#include "Core/PowerPC/PPCTables.h"
scott@ScottDev:~$ cat test.c
#include "test.c"
scott@ScottDev:~$ gcc test.c -o test
In file included from test.c:1:0,
from test.c:1,
from test.c:1,
from test.c:1,
from test.c:1,
from test.c:1,
#include <stdio.h>
#include <stdexcept>
constexpr unsigned requires_inRange(unsigned i, unsigned len) {
// throw a runtime exception to create a compile time error
return i >= len ? throw std::out_of_range("") : i;
}
class StrWrap {
const char *begin_;
#include <stdio.h>
constexpr unsigned static popcnt( const int num, unsigned i = 0, unsigned ans = 0) {
return i == 32 ? ans :
(num >> i)&1 ? popcnt(num, i+1, ans+1) :
popcnt(num, i+1, ans);
}
int main() {
printf("%i\n", popcnt(6));
constexpr unsigned popcnt( const int num) {
return num == 0 ? 0 : (num&1) + popcnt(num>>1);
}
int main(int argc, char **argv) {
int c = popcnt(255);
return c;
}
@phire
phire / popcnt.cpp
Created November 30, 2014 08:35
gcc doesn't optimise
constexpr unsigned popcnt( const int num, unsigned i = 0) {
return i == 32 ? 0 : ((num >> i)&1) + popcnt(num, i+1);
}
int main(int argc, char **argv) {
int c = popcnt(255);
return c;
}