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
// helpers to iterate IDiaEnum* objects | |
let inline toSeq (o: ^T) = | |
let e = { new IEnumerable with member this.GetEnumerator () = (^T: (member GetEnumerator: unit -> _) (o)) } | |
if true then | |
Seq.cast e | |
else | |
// Dummy expression to constrain return type to that of o.Item | |
seq [| (^T: (member Item: _ -> _) (o, Unchecked.defaultof<_>)) |] |
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
" english menu/messages (should be the first line of _vimrc!) | |
language C | |
" activate pathogen | |
call pathogen#infect() | |
" enable syntax highlighting | |
syntax on | |
" color scheme |
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
namespace Collections | |
open System | |
open System.Collections | |
[<AbstractClass>] | |
type LazyList<'T>() = | |
static let notimpl () = raise $ NotImplementedException() | |
abstract member Item: int -> 'T |
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
Vector3 getLightContributionZ1(float x, float y) | |
{ | |
float wedgeVolumeX = x / 2; | |
float wedgeVolumeY = y / 2; | |
float cornerVolume = x * y / 6; | |
float contribX = wedgeVolumeX - cornerVolume; | |
float contribY = wedgeVolumeY - cornerVolume; | |
return Vector3(contribX, contribY, 1 - contribX - contribY); |
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
11:12:45.60360 (6.4333265) 6.43333 0.0 ms 6164:LightGrid: Grid moved, reuploading luminance | |
11:12:46.61360 (6.6403439) 6.64034 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 206849 usec | |
11:12:46.61360 (6.6413441) 6.64134 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 967 usec | |
11:12:46.61360 (6.6423442) 6.64234 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 1025 usec | |
11:12:46.61360 (6.6433443) 6.64334 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 964 usec | |
11:12:46.61360 (6.6443444) 6.64434 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 1080 usec | |
11:12:46.61360 (6.6453445) 6.64534 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 961 usec | |
11:12:46.61360 (6.6463446) 6.64634 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 982 usec | |
11:12:46.61360 (6.6473447) 6.64734 0.0 ms 6164:RBX::LightGrid::lightingUploadChunk took 981 usec | |
11:12:46.61360 (6.6483448) 6.64834 0.0 ms 6164:RBX::LightGrid |
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
import sublime, sublime_plugin | |
import os, stat | |
import subprocess | |
import _thread | |
class P4Checkout(sublime_plugin.EventListener): | |
def on_modified(self, view): | |
def checkout(file): | |
output = subprocess.check_output(["p4", "edit", file], shell=True) | |
print(output.decode()) |
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
// 1. Идея в том, чтобы заменить сравнения сложением с overflow в специально оставленный carry bit; | |
// поскольку каждое значение имеет свой carry bit, сложения можно делать "параллельно" uint64 операциями | |
// 2. Очевидно, решение "почти" кроссплатформенно и почти C (наверное, скомпилируется как C99?). | |
// Из существенного тут используется знание о порядке bitfields -- мне не хотелось переписывать весь | |
// код на битовые операции с uint64 -- и нарушается strict aliasing. Очевидно, исправляется просто. | |
// 3. А вот и тайминги (cl64 /Ox /TP): | |
// Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64 | |
// Generated rows: 100000000 | |
// C-search took 0.778000 seconds. | |
// C++-optimized search took 0.307000 seconds. |
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
#include <stdio.h> /* printf, scanf, NULL */ | |
#include <stdlib.h> /* calloc, exit, free */ | |
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */ | |
#include <memory> // std::unique_ptr<> | |
#include <array> // std::array<> | |
#include <type_traits> // std::enable_if<> | |
#include <iostream> // std::cout | |
#include <map> // std::map<> |
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
#include <stdio.h> | |
template <typename R, typename F> R callf(void* buffer, F func) | |
{ | |
return func(); | |
} | |
template <typename R, typename F, typename ArgHead, typename ...ArgTail> R callf(void* buffer, F func) | |
{ | |
ArgHead* head = static_cast<ArgHead*>(buffer); |