Skip to content

Instantly share code, notes, and snippets.

View RealNeGate's full-sized avatar

Yasser Arguelles Snape RealNeGate

  • Washington, USA
View GitHub Profile
// MIT License
//
// Copyright (c) 2021 Yasser Arguelles Snape
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#define INITIAL_CAP 64
typedef struct ArrayHeader {
// honestly storing the type size is kinda weird
size_t size, capacity;
#include <cstdlib>
#include <string>
#include <numeric>
#include <execution>
// enable modern c++ if you're a cool enterprise person
#if MODERN_CPP
bool is_word_beginning(char l, char r) { return std::isspace(l) && !std::isspace(r); }
std::size_t word_count(std::string_view s) {

unfinished :p

SSE instructions (OP refers to the opcodes in the table below):

  ___ss 32 x 1  F3 0F OP ...
  ___sd 64 x 1  F2 0F OP ...
  ___ps 32 x 4     0F OP ...
  ___pd 64 x 2  66 0F OP ...
#include <stdio.h>
static const char* find_char(const char* s, int ch) {
while (*s && *s != ch) s++;
return *s == ch ? s + 1 : s;
}
#define BALLER(start, end, text) \
for (const char* start = text, *end; \
end = find_char(start, ' '), (end-start) > 1; \
// I tried not doing anything too non-portable so it should be possible to run
// this on Mac or Linux... probably... even then, you can't use the obj files there
//
// once you have the obj file you should be able to do:
// link YOUROBJ.obj /defaultlib:libcmt
// ^^^^^^^^^^^^^^^^^^
// linking against crt
#define _CRT_SECURE_NO_WARNINGS
#include <stdint.h>
#include <stdlib.h>
// Reject modernity, return to wrinkly ass GL shit
#if !defined(_WIN32)
#error "Fuck you"
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#pragma comment(lib, "opengl32.lib")
#define NL_STRING_MAP_IMPL
#include "string_map.h"
int main() {
NL_StringMap table = nl_string_map_init(7);
nl_string_map_insert_cstr(&table, "glRasterPos4iv", NULL);
nl_string_map_insert_cstr(&table, "PackTouchHitTestingProximityEvaluation", NULL);
nl_string_map_insert_cstr(&table, "GetPointerPenInfo", NULL);
nl_string_map_insert_cstr(&table, "GetCIMSSM", NULL);
// I'm going to hell for this one...
//
// https://godbolt.org/z/PjxjveaG4
#include <stdbool.h>
#include <stddef.h>
#ifdef __clang__
#define typeof(x) __typeof__(x)
#endif
#define UNICODE
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>