This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MapSharedPages(VMManager& address_space) { | |
auto cfg_mem_vma = address_space | |
.MapBackingMemory(Memory::CONFIG_MEMORY_VADDR, | |
reinterpret_cast<u8*>(&ConfigMem::config_mem), | |
Memory::CONFIG_MEMORY_SIZE, MemoryState::Shared) | |
.MoveFrom(); | |
address_space.Reprotect(cfg_mem_vma, VMAPermission::Read); | |
auto shared_page_vma = address_space | |
.MapBackingMemory(Memory::SHARED_PAGE_VADDR, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eye e1; | |
void setup() { | |
size(640, 360); | |
noStroke(); | |
e1 = new Eye(640/2, 360/2, 64); | |
} | |
void draw() { | |
background(102); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |