Skip to content

Instantly share code, notes, and snippets.

View UplinkCoder's full-sized avatar

Stefan Koch UplinkCoder

View GitHub Profile
#include <stdio.h>
#include <string.h>
/*
&apos; is replaced with '
&amp; is replaced with &
&quot; is replaced with "
&lt; is replaced with <
&gt; is replaced with >
*/
metac_expr_t* MetaCParser_ParseExpr2(metac_parser_t* self, parse_expr_flags_t flags)
{
metac_expr_t* result = NULL;
metac_token_t* currentToken = NULL;
metac_token_enum_t tokenType = tok_invalid;
metac_expr_kind_t leftOp = expr_invalid;
metac_expr_kind_t op = expr_invalid;
uint32_t prec = 0;
uint32_t opPrec = 0;
// #include "../os/compat.h"
#include <stdint.h>
#include <assert.h>
#ifndef cast
# define cast(T) (T)
#endif
#ifdef __ARM_FEATURE_CRC32
# define ARM_NEON_CRC32C
<!DOCTYPE html>
<html>
<head>
<title>REPL UI with Add Tab Button</title>
<style>
/* Basic styles */
.tab {
display: none;
}
.active {
-- Table: Fields
CREATE TABLE IF NOT EXISTS Fields (
StructIndex INTEGER PRIMARY KEY NOT NULL,
FieldIndex INTEGER,
Identifier INTEGER,
TypeIndex INTEGER,
Offset INTEGER,
FOREIGN KEY (Identifier) REFERENCES Identifiers (Index),
FOREIGN KEY (TypeIndex) REFERENCES Types (Index)
);
@UplinkCoder
UplinkCoder / eval_func.c
Last active August 6, 2022 13:49
parses a file, compiles a function function and executes it
#define ACCEL ACCEL_TABLE
#define NO_FIBERS
#define NO_PREPROCESSOR
#include "compat.h"
#include "metac_driver.c"
#include "utils/read_file.c"
#include "metac_parser_obj.c"
#include "metac_semantic_obj.c"
#include "metac_lpp.c"
#define ACCEL ACCEL_TABLE
#define NO_FIBERS
#define NO_PREPROCESSOR
#include "compat.h"
#include "metac_driver.c"
#include "utils/read_file.c"
#include "metac_parser_obj.c"
#include "metac_semantic_obj.c"
#include "metac_lpp.c"
#define NO_FIBERS
#define ACCEL ACCEL_TABLE
#include "../compat.h"
#include "../utils/read_file.c"
#include "../crc32c.h"
#include "../metac_parser_obj.c"
#include "../metac_semantic_obj.c"
#include "../metac_driver.c"
#define SPWAN_TASK(RESULT, FUNC, ...) do { \
taskqueue_t* q = &CurrentWorker()->Queue; \
task_t task = {0}; \
CTX_TYPE(FUNC) ctx = {__VA_ARGS__}; \
CTX_TYPE(FUNC)* ctxPtr = &ctx; \
STATIC_ASSERT(sizeof(task._inlineContext) >= sizeof(CTX_TYPE(FUNC)), \
"Context size too large for inline context storage"); \
task.Context = task._inlineContext; \
task.TaskFunction = CAT(FUNC, Task); \
task.Parent = CurrentTask(); \
uint8_t getMask(const int16_t hash, const int16x8_t LRU)
{
// assert(hash & 0xF == 0);
const int16x8_t hash8 = {hash, hash, hash, hash,
hash, hash, hash, hash};
const int16x8_t LRUHashes = LRU & ~0xF;
const int16x8_t matches = LRUHashes == hash8;
// == sets the result element to 0xFF on match
const int16x8_t multi = {1 << 0, 1 << 1, 1 << 2, 1 << 3,
1 << 4, 1 << 5, 1 << 6, 1 << 7};