The source files below should be arranged as:
./main.go
./sqrt/sqrt.s
./sqrt/sqrt.go
To run:
/* I always wondered how variable length arguments worked in C. | |
* So, I just ended up implementing it in x86. | |
* NOTE: THIS CODE BELOW ONLY WORKS IN x86, AND NOT TESTED IN ANY OTHER ARCHITECTURE. | |
* | |
* To compile: | |
* gcc -Wall -o prog vargs.c && ./prog | |
* >> Testing: Hello world 10 -100 | |
*/ | |
/* |
The source files below should be arranged as:
./main.go
./sqrt/sqrt.s
./sqrt/sqrt.go
To run:
#ifndef ABS | |
#ifdef __GNUC__ | |
#define ABS(x) __extension__({ \ | |
__builtin_choose_expr( \ | |
__builtin_types_compatible_p(__typeof__(x), long int), \ | |
__builtin_labs(x), \ | |
__builtin_choose_expr( \ | |
__builtin_types_compatible_p(__typeof__(x), int), \ | |
__builtin_abs(x), \ |
__module_name__ = "Hexchat L33T" | |
__module_version__ = "1.0" | |
__module_description__ = "Do you speak l33t? No? Well, now you can with /l33t" | |
__author__ = "ashafq" | |
import hexchat | |
import random | |
def l33t_enc(string): |
#include <stddef.h> | |
#include <assert.h> | |
#include <immintrin.h> | |
static void v_f32_to_s1x15i(int16_t *dst, const float *src, size_t len) | |
{ | |
const __m128 minval = _mm_set1_ps(-1.0F); | |
const __m128 maxval = _mm_set1_ps(+0x7fffff8p-27F); | |
const __m128 scale = _mm_set1_ps(32768.0F); |
#![feature(asm)] | |
fn rdtsc() -> u64 { | |
let eax: u32; | |
let edx: u32; | |
unsafe { | |
asm!("rdtsc; ": /* Assembly */ | |
"={eax}"(eax), "={edx}"(edx) : /* Output registers */ | |
: /* Input registers */ |
#include <math.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <sys/types.h> | |
#include <unistd.h> |
/** | |
* @brief A shitty password generator in C++ | |
*/ | |
// | |
// It's 2019, yet no command line parsers in C++ :'( | |
// | |
#include <boost/program_options.hpp> | |
namespace opt = boost::program_options; |
// | |
// FizzBuzz in RISC-V Assembly | |
// build: riscv64-elf-gcc -mcmodel=medany -nostdlib \ | |
// -march=rv32im -mabi=ilp32 -o start start.s | |
// run: Open in Ripes simulator ;) | |
// | |
.section .rodata | |
// Strings need to be aliged to two byte boundaries |
#include <immintrin.h> | |
static void mat8x8mul(float *dst, const float *src_a, const float *src_b) | |
{ | |
// Load 8 rows of B into 8 YMM registers | |
__m256 b0 = _mm256_load_ps(src_b + (0 * 8)); | |
__m256 b1 = _mm256_load_ps(src_b + (1 * 8)); | |
__m256 b2 = _mm256_load_ps(src_b + (2 * 8)); | |
__m256 b3 = _mm256_load_ps(src_b + (3 * 8)); | |
__m256 b4 = _mm256_load_ps(src_b + (4 * 8)); |