Skip to content

Instantly share code, notes, and snippets.

easyaspi314 (Devin) easyaspi314

Block or report user

Report or block easyaspi314

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@easyaspi314
easyaspi314 / xxh3-rust.rs
Created Jul 8, 2019
xxh3_64bits in Rust
View xxh3-rust.rs
///
/// xxHash - Extremely Fast Hash algorithm
/// Rust implementation of XXH3_64bits
/// Copyright (C) 2019-present, Yann Collet.
///
/// BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
///
/// Redistribution and use in source and binary forms, with or without
/// modification, are permitted provided that the following conditions are
/// met:
@easyaspi314
easyaspi314 / gimpcairo.c
Created May 7, 2019
gimpcairo.c reformat
View gimpcairo.c
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcairo.c
* Copyright (C) 2007 Sven Neumann <sven@gimp.org>
* 2010-2012 Michael Natterer <mitch@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@easyaspi314
easyaspi314 / Product.c
Created Apr 8, 2019
Faversaver project in C
View Product.c
#include "Product.h"
#include "ErrorState.h"
#include "iProduct.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const struct iProductVtable Product_vtable;
@easyaspi314
easyaspi314 / README.md
Last active Mar 18, 2019
gets, but safer thanks to GNU extensions
View README.md

gets but safer

This is like gets. It is a drop in for gets. It is smarter though.

gets_safe, which is aliased to gets for convenience, takes an optional length argument, but it also uses GCC and Clang's __builtin_object_size builtin to calculate the length.

The length will not always be calculated properly, but for static arrays and malloc'd pointers in the current block with a fixed size (only with optimizations), it will usually pick up on it.

This also has a safety feature: If it can properly calculate the length and the supplied length is larger than the one it calculated, it will be an error. Additionally, when both the optional length parameter are omitted and the length cannot be calculated at compile time, it is an error.

@easyaspi314
easyaspi314 / assembler.c
Last active Mar 8, 2019
A WIP Thumb-like 8-bit assembly language which interprets C structs
View assembler.c
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#if __STDC_VERSION__ >= 201112L
# include <stdnoreturn.h>
#elif defined(__GNUC__)
# define noreturn __attribute__((__noreturn__))
@easyaspi314
easyaspi314 / README.md
Last active Feb 25, 2019
C+: Another Better C
View README.md

C+: Another Better C

C+ is like halfway between C11 and C++.

Unlike C++, C+ remains a procedural language, and some things are intentionally left out.

Here are some potential ideas.

First, what will be removed:

@easyaspi314
easyaspi314 / _README.md
Last active Feb 17, 2019
iostream.h: cin and cout for C using GCC and C11 extensions
View _README.md

iostream.h

iostream.h (ab?)uses _Generic, __builtin_choose_expr, __typeof__, statement expressions, and recursive variadic macro expansion to create a cin and cout for C11+GCC extension compilers.

Should you use this? Of course not. But it's pretty f***ing cool.

Usage

@easyaspi314
easyaspi314 / change_case_simd.c
Created Feb 6, 2019
SIMD functions to apply toupper/tolower to each character in a string
View change_case_simd.c
/* Created by easyaspi314. Released into the public domain. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __SSE2__
#include <immintrin.h>
@easyaspi314
easyaspi314 / tolowersimd.c
Created Feb 6, 2019
tolower SIMD implementation
View tolowersimd.c
/* Created by easyaspi314.
* Released into the public domain. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __SSE2__
#include <immintrin.h>
View cppcheck output
[pragma.c:4]: (style) The scope of the variable 'bar' can be reduced.
[pragma.c:7]: (style) Variable 'bar' is assigned a value that is never used.
You can’t perform that action at this time.