Skip to content

Instantly share code, notes, and snippets.

View yuriks's full-sized avatar

Yuri Kunde Schlesner yuriks

View GitHub Profile
@yuriks
yuriks / playground.rs
Created April 17, 2017 06:01 — forked from anonymous/playground.rs
Shared via Rust Playground
const TEST_DATA : &'static str = "Device: ID=1; Fw=16071801; Evt=2; Alarms: CoilRevesed=OFF; Power: Active=1753W; Reactive=279var; Appearent=403VA; Line: Current=7.35900021; Voltage=230.08V; Phase=-43,841rad; Peaks: 7.33199978;7.311999799999999;7.53000021;7.48400021;7.54300022;7.62900019;7.36499977;7.28599977;7.37200022;7.31899977; FFT Re: 9748;46;303;33;52;19;19;39;-455; FFT Img: 2712;6;-792;-59;1386;-19;963;33;462; UTC Time: 2016-10-4 16:47:50; hz: 49.87; WiFi Strength: -62; Dummy: 20";
fn partition(s: &str) -> (&str, Option<char>, &str) {
const TOKEN_SEPARATORS : &'static [char] = &[':', '=', ';'];
let idx = s.find(TOKEN_SEPARATORS).unwrap_or(s.len());
let (head, tail) = s.split_at(idx);
let mut tail_it = tail.chars();
let separator = tail_it.next();
(head, separator, tail_it.as_str())
a*x + b*y + c*z + d*w
1 MUL A, X (4, 0.5)
2 MOV X, A
3 SHUFPS A, A (1, 1)
4 ADD A, X (4, 0.5)
5 MOV X, A
6 SHUFPS A, A (1, 1)
7 ADD A, X (4, 0.5)
/**
* Adds the game list folder to the QFileSystemWatcher to check for updates.
*
* The file watcher will fire off an update to the game list when a change is detected in the
* game list folder.
*
* Notice: This method is run on the UI thread because QFileSystemWatcher is not thread safe
* and this function is fast enough to not stall the UI thread. If performance is an issue, it
* should be moved to another thread and properly locked to prevent concurrency issues.
*
--- c:\users\yuriks\projects\3ds\citra\src\video_core\shader\shader.cpp --------
void UnitState::WriteOutput(const Regs::ShaderConfig& config, AttributeBuffer& output) {
48 89 5C 24 08 mov qword ptr [rsp+8],rbx
for (unsigned int reg : Common::BitSet<u32>(config.output_mask)) {
44 0F B7 4A 34 movzx r9d,word ptr [rdx+34h]
unsigned int output_i = 0;
45 33 D2 xor r10d,r10d
4D 8B D8 mov r11,r8
48 8B D9 mov rbx,rcx
/// Initialize hardware
void Init() {
memset(&g_regs, 0, sizeof(g_regs));
auto& framebuffer_top = g_regs.framebuffer_config[0];
auto& framebuffer_sub = g_regs.framebuffer_config[1];
// Setup default framebuffer addresses (located in VRAM)
// .. or at least these are the ones used by system applets.
// There's probably a smarter way to come up with addresses
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index fda91e2..5d284a8 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -236,7 +236,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
// The size has been tuned for optimal balance between hit-rate and the cost of lookup
const size_t VERTEX_CACHE_SIZE = 32;
std::array<u16, VERTEX_CACHE_SIZE> vertex_cache_ids;
- std::array<Shader::OutputRegisters, VERTEX_CACHE_SIZE> vertex_cache;
+ std::array<Shader::OutputVertex, VERTEX_CACHE_SIZE> vertex_cache;
Eye e1;
void setup() {
size(640, 360);
noStroke();
e1 = new Eye(640/2, 360/2, 64);
}
void draw() {
background(102);
def integer_root(x):
i = 0
step = 1
sum = 0
while True:
if sum + step > x: break
sum += step
step += 2
i += 1
return i
@yuriks
yuriks / vshader.v.pica
Created January 22, 2016 07:03
Nested loop test
.constf foo0(0.1 , 0.0, 0.0 , 1.0)
.constf foo1(0.0 , 0.0, 0.0 , 1.0)
.constf foo2(0.0 , 0.0, 0.0 , 1.0)
.constf foo3(0.0 , 0.0, 0.11, 1.0)
.constf foo4(0.0 , 0.0, 0.0 , 1.0)
.constf foo5(0.0 , 0.0, 0.0 , 1.0)
.consti loopParams1(2, 0, 1, 0)
.consti loopParams2(2, 3, 1, 0)
7134a17fc6cb7ab8ae46dae04f005bb72e0af88e is the first bad commit
commit 7134a17fc6cb7ab8ae46dae04f005bb72e0af88e
Author: archshift <gh@archshift.com>
Date: Mon Aug 31 18:29:23 2015 -0700
Split up FileUtil::ScanDirectoryTree to be able to use callbacks for custom behavior
Converted FileUtil::ScanDirectoryTree and FileUtil::DeleteDirRecursively
to use the new ScanDirectoryTreeAndCallback function internally.