This file contains 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
---- On Ryzen 3950X | |
SimpleProf :seconds calls count : clk/call clk/count | |
search_one : 0.3081 1 8388480 : 1078358365.0 128.55 | |
search_one_pf : 0.3415 1 8388480 : 1195232920.0 142.49 <-- speculative prefetching (next options for L and R) | |
search_multi2 : 0.3062 1 8388480 : 1071663705.0 127.75 | |
search_multi4 : 0.2454 1 8388480 : 859008465.0 102.40 | |
search_multi8 : 0.2113 1 8388480 : 739533515.0 88.16 | |
search_multi16 : 0.1996 1 8388480 : 698443550.0 83.26 | |
search_multi32 : 0.1785 1 8388480 : 624785840.0 74.48 |
This file contains 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
// Lexer | |
#define TOK_CHAR(ch1, tok1) \ | |
case ch1: \ | |
next_ch(); \ | |
tok = TOK_##tok1; \ | |
tok_prec = 0; \ | |
break; | |
#define TOK_EXPR(ch1, tok1, prec1, lexpr1, rexpr1) \ |
This file contains 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 parse_expr(Value *dest); | |
Sym *parse_ident(void) { | |
if (tok != TOK_IDENT) { | |
error("Expected identifier"); | |
} | |
Sym *ident = tok_sym; | |
next(); | |
return ident; | |
} |
This file contains 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
// x64 encoding | |
enum Reg { | |
RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, | |
R8, R9, R10, R11, R12, R13, R14, R15, | |
}; | |
enum XmmReg { | |
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, | |
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, |
This file contains 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
#define RUN_ME /* | |
exec cc -g -ggdb -O2 -W -Wall -std=c99 $0 -o "$(basename $0 .c)" | |
*/ | |
/* | |
* Copyright 2020 Paul Khuong | |
* SPDX-License-Identifier: BSD-2-Clause | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions |
This file contains 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
from numba.cuda.cudadrv import error | |
from numba.cuda.cudadrv.driver import driver, is_device_memory, device_ctypes_pointer | |
from ctypes import POINTER, Structure, c_void_p, c_int, c_uint, byref, addressof, pointer | |
# https://github.com/numba/numba/blob/e8ac4951affacd25c63ba2c18d62a3f12ed7e0ba/numba/cuda/cudadrv/driver.py#L259 | |
def get_fn(fname, restype, *argtypes): | |
if not driver.is_initialized: | |
driver.initialize() | |
if driver.initialization_error is not None: |
This file contains 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
// CHANGE the clock prescale in mcpwm.c file to make possible get 30000hz of pwm frequency (15Khz in center aligned mode) | |
#define MCPWM_BASE_CLK (2 * APB_CLK_FREQ) //2*APB_CLK_FREQ 160Mhz | |
#define MCPWM_CLK_PRESCL 1 //MCPWM clock prescale Original = 15 <--------------------- | |
#define TIMER_CLK_PRESCALE 1 //MCPWM timer prescales Original = 9 <--------------------- | |
#define MCPWM_CLK (MCPWM_BASE_CLK/(MCPWM_CLK_PRESCL +1)) | |
#define MCPWM_PIN_IGNORE (-1) | |
#define OFFSET_FOR_GPIO_IDX_1 6 | |
#define OFFSET_FOR_GPIO_IDX_2 75 |
This file contains 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
// works as of 2019-03-02 | |
(function() { | |
// This function forces rustdoc to collapse documentation for all items, | |
// except for the methods defined in an impl block and the primary type's | |
// declaration. This is the most natural view IMO, since it provides the | |
// primary type along with an easy to scan overview of available methods. | |
// | |
// rustdoc does seemingly have user settings that purport to make this the | |
// default, but I could never cause them to work in a reliably consistent | |
// way. This is especially useful when writing documents, where you commonly |
This file contains 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
# Get releases for your repository (change the URL and add user/password if necessary) | |
# If there's more than one page, you might have to do more requests with `?page=2` etc | |
curl https://api.github.com/repos/:owner/:repo/releases > releases.json | |
# Use jq! https://stedolan.github.io/jq/ | |
# "v" is a prefix to strip from the release names, might not be necessary | |
jq -r '.[] | "## [" + (.name | ltrimstr("v")) + "] - " + .created_at[:10] + "\n" + .body' releases.json >> CHANGELOG.md | |
# Now edit the CHANGELOG.md, see here: http://keepachangelog.com/en/1.0.0/ |
This file contains 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
#pragma comment(lib, "SDL2") | |
#pragma comment(lib, "SDL2main") | |
#include "SDL.h" | |
#include <vector> | |
#include <unordered_map> | |
#include <assert.h> | |
#include <algorithm> |