This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct real_gc_base { | |
virtual ~real_gc_base() {} | |
}; | |
struct gc : virtual real_gc_base { | |
}; | |
struct b1 : gc { | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0009r4.html | |
#include <utility> | |
#include <array> | |
#include <algorithm> | |
#include <functional> | |
#include <type_traits> | |
#include <memory> | |
#include <exception> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <variant> | |
#include <string_view> | |
#include <vector> | |
#include <unordered_map> | |
#include <utility> | |
namespace json { | |
struct Value; | |
using Null = std::nullptr_t; | |
using Bool = bool; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intel(R) Core(TM) i7-7900X CPU @ 3.30GHz | |
Maximum frequency: 3301 MHz (as reported to/by Windows, which seems in fact to be the base frequency at P0) | |
rdtsc ticks at 3311999074 ticks per second | |
measurement overhead in ticks: 11 | |
\ core-to-core ping time/ns | |
\ destination | |
source \ 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| | |
__________\_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____| | |
0 | -| 16| 91| 91| 98| 99| 98| 96| 84| 87| 104| 93| 96| 97| 91| 97| 97| 90| 82| 81| | |
1 | 20| -| 93| 93| 100| 100| 99| 97| 87| 89| 106| 94| 98| 98| 92| 99| 98| 92| 84| 83| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> // fuck anyone who writes 'class T' | |
struct alignas(T) speculative_buffer { | |
static_assert(std::is_default_constructible_v<T>, "T must be DefaultConstructible"); | |
static_assert(std::is_trivially_copyable_v<T>, "T must be TriviallyCopyable"); | |
speculative_buffer(T* src) { | |
unsafe_read(src); | |
} | |
void unsafe_read(T* src) { // nb: can read from any pointer, does not need to be atomic etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// Copyright(c) 2017 Peter Bright | |
// | |
// This software is provided 'as-is', without any express or implied | |
// warranty. In no event will the authors be held liable for any damages | |
// arising from the use of this software. | |
// | |
// Permission is granted to anyone to use this software for any purpose, | |
// including commercial applications, and to alter it and redistribute it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDKDDKVer.h> | |
#pragma warning(disable: 4710) // warning C4710: '%s': function not inlined | |
#pragma warning(disable: 4668) // warning C4668: '%s' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' | |
#pragma warning(disable: 4820) // warning C4820: '%s': '%d' bytes padding added after data member '%s' | |
#define STRICT | |
#define NOMINMAX | |
#include <Windows.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// positive rotations go left, negative go right | |
void rotate(int arr[], const ptrdiff_t len, const ptrdiff_t m) { | |
if(0 == m || m >= len) { | |
return; | |
} | |
ptrdiff_t dst = 0; | |
ptrdiff_t first_in_cycle = 0; | |
int tmp = arr[first_in_cycle]; | |
for(ptrdiff_t i = 0; i < len; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void store_buffers() { | |
static constexpr size_t items = 1ULL << 24; | |
static constexpr size_t mask = items - 1; | |
static constexpr size_t iterations = 1'000'000'000; | |
std::vector<std::vector<unsigned char> > arrays{ 12, std::vector<unsigned char>(items, '\0') }; | |
::SetThreadPriority(::GetCurrentThread(), THREAD_PRIORITY_HIGHEST); | |
__int32 unused[4]; | |
unsigned __int32 also_unused; | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vcruntime.h> | |
__std_win32_error __std_fs_equivalent(bool * _Result, const wchar_t *_Path1, const wchar_t *_Path2) noexcept | |
{ // test for equivalent file names | |
const __vcp_unique_handle _Handle1(_FilesysOpenFile(_Path1, FILE_READ_ATTRIBUTES, FILE_FLAG_BACKUP_SEMANTICS)); | |
if (!_Handle1.is_valid()) | |
{ | |
*_Result = false; | |
return (GetLastError()); | |
} |
NewerOlder