Instantly share code, notes, and snippets.

💭
Drunk again ... the usual.

degski

View GitHub Profile
@degski
degski / fab.hpp
Created Feb 5, 2019
floats as bits print structure
View fab.hpp
struct float_as_bits {
float_as_bits ( const float & v_ ) : value { v_ } { };
float_as_bits ( float && v_ ) : value { std::move ( v_ ) } { };
template<typename Stream>
[[ maybe_unused ]] friend Stream & operator << ( Stream & out_, const float_as_bits & v_ ) noexcept {
std::uint32_t v;
std::memcpy ( &v, &v_.value, 4 );
View hex.cpp
// MIT License
//
// Copyright (c) 2019 degski
//
// 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
@degski
degski / CentripetalCatmullRom.cpp
Last active Oct 2, 2018
Centripetal Catmull-Rom curves
View CentripetalCatmullRom.cpp
#include <cmath>
#include <iostream>
#include <utility>
#include <SFML/Graphics.hpp>
// https://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/23980479#23980479
@degski
degski / invertible_hash_functions.hpp
Last active Feb 18, 2019
invertible hash functions
View invertible_hash_functions.hpp
// MIT License
//
// Copyright (c) 2018 degski
//
// 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
@degski
degski / statistics.hpp
Created Jul 20, 2018
The main statistics of a vector/array of data
View statistics.hpp
// MIT License
//
// Copyright (c) 2018 degski
//
// 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
@degski
degski / lehmer.hpp
Created Jul 9, 2018
re-write of lehmer.hpp (https://gist.github.com/imneme/aeae7628565f15fb3fef54be8533e39c) as a workaround for an ICE in Clang/LLVM
View lehmer.hpp
#ifndef LEHMER_HPP_INCLUDED
#define LEHMER_HPP_INCLUDED 1
/*
* A C++ implementation of fast, 128-bit, Lehmer-style PRNGs
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Melissa E. O'Neill
* Copyright (c) 2018 degski
@degski
degski / shift_rotate_avx2.cpp
Last active Jul 8, 2018
lane-crossing shift and rotate instructions in AVX2
View shift_rotate_avx2.cpp
// MIT License
//
// Copyright (c) 2018 degski
//
// 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
View seed_seq_fe.hpp
/* boost random/seed_seq_fe.hpp header file
*
* Copyright Melissa E. O'Neill 2015
* Copyright degski 2017
* Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org for most recent version including documentation.
*