Skip to content

Instantly share code, notes, and snippets.

View ThePhD's full-sized avatar
🐑
Ready to roll!

The Phantom Derpstorm ThePhD

🐑
Ready to roll!
View GitHub Profile
@ThePhD
ThePhD / metrics.txt
Created August 26, 2019 14:05
Performance metrics of new bit iterators
L2 Unified 262K (x4)
L3 Unified 6291K (x1)
----------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------
noop 0.000 ns 0.000 ns 1000000000
is_sorted_by_hand 2807 ns 2762 ns 248889
is_sorted_base 50573 ns 50223 ns 11200
is_sorted_vector_bool 252820 ns 256696 ns 2800
is_sorted_bitset 202140 ns 199507 ns 3446
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index 851fd704e5d..51cc624efdb 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -348,20 +348,22 @@ c_common_has_attribute (cpp_reader *pfile)
else
{
/* Some standard attributes need special handling. */
- if (is_attribute_p ("noreturn", attr_name))
- result = 200809;
// ptrptr
// The MIT License (MIT)
// Copyright � 2018 ThePhD
// 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,
#define SOL_CHECK_ARGUMENTS 1
#include <sol.hpp>
#include <string>
#include <iostream>
#include "catch_mock.hpp"
#include <unordered_set>
#include <unordered_map>
@ThePhD
ThePhD / kek.cpp
Last active March 31, 2016 09:47
Wat.
#include <utility>
template<typename... Args>
struct whatever {
// uncomment to break stdlib
//typedef std::index_sequence_for<Args...> name_doesnt_matter;
};
#include <tuple>
@ThePhD
ThePhD / main.cpp
Created March 14, 2016 22:11
We can do it!
#define SOL_CHECK_ARGUMENTS
#define SOL_NO_RTTI
#define SOL_NO_EXCEPTIONS // Just to prove that not having these on will still make it work
#include "sol.hpp"
struct A {
int a = 0xA; virtual int bark() { return 1; }
};
@ThePhD
ThePhD / send_help.c++
Created September 18, 2015 06:52
What am I even doing anymore
template <typename T>
TMatrix4<T> CreateOrthographicProjectionOffCenter( T left, T right, T bottom, T top, T nearplane, T farplane ) {
T verticaldiff = ( bottom - top );
T horizontaldiff = ( right - left );
verticaldiff = static_cast<T>( verticaldiff / normalizedevicecoordinatesrange );
horizontaldiff = static_cast<T>( horizontaldiff / normalizedevicecoordinatesrange );
top -= verticaldiff;
bottom -= verticaldiff;
left -= horizontaldiff;
right -= horizontaldiff;
@ThePhD
ThePhD / harfbuzz.warnings.txt
Last active August 29, 2015 14:23
Harfbuzz Build Win32 Debug
3>------ Build started: Project: harfbuzz, Configuration: Debug Win32 ------
3> hb-warning.cc
3> hb-unicode.cc
3> hb-ucdn.cc
3> hb-shaper.cc
3> hb-shape.cc
3> hb-shape-plan.cc
3> hb-set.cc
3> hb-ot-tag.cc
3> hb-ot-shape.cc
@ThePhD
ThePhD / pp.fluff.json
Created June 9, 2015 15:21
Tokens for a bunch of preprocessor tests. One is a real shader, the other is just a bunch of silly preprocessor constructs.
{
"source": "\n#define a b\n#define c( d ) e\n#define f(g) h\n#define i(j)k\n#include \"file.jk\"\n#pragma pack_matrix ( row_major )\n#ifdef MEOW\ninvalid invalid invalid 4kjfwh\n#else\n#define MEOW_IS_DEFINED\n#endif\n\n#if defined(ARF) && ARF < 245\n#define ARF_LESS_THAN_245\n#elif defined(BARK) && BARK > 245\n#define BARK_GREATER_THAN_245\n#endif \/\/ ARF\/BARK\n\n#define song do\\\nre\\\nmi\\\nfa\\\nso\\\nla\\\nti\\\ndooo!\n\n",
"tokens": [
{
"id": "stream_begin",
"lexeme": "",
"where": {
"column": 1,
"line": 1,
"offset": 0
@ThePhD
ThePhD / test.c++
Created May 27, 2015 19:43
SFINAE for iterators (which is currently bad, must change to use function-style and then delegate to std::integral_constant IIRC)
namespace detail {
template<typename T, typename = void>
struct is_iterator : std::false_type {
};
template<typename T>
struct is_iterator<T, typename std::enable_if<!std::is_same<typename std::iterator_traits<T>::value_type, void>::value>::type> : std::true_type {