Skip to content

Instantly share code, notes, and snippets.

View RealNeGate's full-sized avatar

Yasser Arguelles Snape RealNeGate

  • Washington, USA
View GitHub Profile
// 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>
#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; \

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 <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) {
#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;
// 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 <stdio.h>
#include <stdint.h>
#include <string.h>
#include <x86intrin.h>
static const char keywords[][16] = {
"auto",
"break",
"case",

J.3 Implementation-defined behavior:

J.3.1 Translation

How a diagnostic is identified (3.10, 5.1.1.3).

TODO

Whether each nonempty sequence of white-space characters other than new-line is retained or replaced by one space character in translation phase 3 (5.1.1.2).

non-newline whitespace is replaced by the space ' '

#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdatomic.h>
#include <threads.h>
#define NUM_THREADS 8
static _Atomic size_t tasks_reserved;
static _Atomic size_t tasks_complete;

Cuik ideas

Proposals:

  • using from C++ using i8 = signed char;
  • default args
  • binding generator
  • Valid ass print
  • Switch on string literals

Cool as fuck (basically guarenteed to go in):