Skip to content

Instantly share code, notes, and snippets.

@monocasa
monocasa / serv_top.json
Created June 15, 2024 23:22
serv_top.json
{
"creator": "Yosys 0.42+12 (git sha1 a55e8594b, g++ 13.2.0-23ubuntu4 -fPIC -Os)",
"modules": {
"serv_top": {
"attributes": {
"dynports": "00000000000000000000000000000001",
"top": "00000000000000000000000000000001",
"src": "serv_top.v:3.1-658.10"
},
"parameter_default_values": {
@monocasa
monocasa / gist:befeed9c8c5827417c0921e231703f2c
Created January 10, 2022 21:45
crypto/256 benchmarks. (shani versus master)
~/src/go $ ../bin/go test -bench . -benchmem crypto/sha256/
goos: linux
goarch: amd64
pkg: crypto/sha256
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
BenchmarkHash8Bytes-8 6923472 168.6 ns/op 47.45 MB/s 0 B/op 0 allocs/op
BenchmarkHash1K-8 506968 2238 ns/op 457.62 MB/s 0 B/op 0 allocs/op
BenchmarkHash8K-8 70969 16687 ns/op 490.91 MB/s 0 B/op 0 allocs/op
PASS
ok crypto/sha256 3.861s
// Compiled with gcc -O2 -o magic magic.c
//
// Results in the following result on an i7-6820HQ
//
// $ ./magic
// slow: 0.019839 microseconds per write
// fast: 0.001779 microseconds per write
// magic: 0.001779 microseconds per write
#include <stdio.h>
/* Compile with
* gcc -O2 -Wall -Wextra -pedantic -o test_bits test_bits.c
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sched.h>
#include <stdint.h>
@monocasa
monocasa / gist:16f3821b7ff67499ea6f
Created March 3, 2015 15:06
Mantle DLL Exports
MANTLE64.DLL
grInitAndEnumerateGpus
grGetGpuInfo
grCreateDevice
grDestroyDevice
grGetExtensionSupport
grGetDeviceQueue
grQueueSubmit
grQueueWaitIdle
@monocasa
monocasa / dyn_dispatch.c
Created January 22, 2015 17:52
C Dynamic Dispatch
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
struct Petable
{