Skip to content

Instantly share code, notes, and snippets.

View davezarzycki's full-sized avatar

David Zarzycki davezarzycki

View GitHub Profile
@davezarzycki
davezarzycki / crc64_up_to_191_bits.cpp
Last active June 23, 2022 02:02
CRC examples with poly: 0x(1)E691A23E28619DF3
// Copyright (c) 2022 David Zarzycki
//
// 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, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@davezarzycki
davezarzycki / gist:c0b4898571ecdc6c23c1d9dc7c608f10
Last active March 16, 2022 12:49
The answer to the load(seq_cst) twitter poll
Yes, load(seq_cst) can be reordered!
The reason is that sequential consistency as a memory order is only guaranteed
relative to other operations that also use sequential consistency. Everything else
is fair game.
In practice, this can be surprising to people that mix atomic primitives:
a.store(b, RELEASE); // or any nonatomic load/store and some atomic ops
x = y.load(SEQCST); // this is allowed to execute before non-seq_cst code
// Copyright (c) 2021 David Zarzycki
//
// 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, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in

Keybase proof

I hereby claim:

  • I am davezarzycki on github.
  • I am davez (https://keybase.io/davez) on keybase.
  • I have a public key ASAD0MG-jru6-copfqqlMAr7FsEz7P3zgXncDloDrklSKwo

To claim this, I am signing this object:

@davezarzycki
davezarzycki / InlineBitfield.h
Created November 22, 2019 21:39
Inline bitfield macros
//===--- InlineBitfield.h - Inline bitfield macros --------------*- C++ -*-===//
//
// Copyright (c) 2017-2018 David Zarzycki
//
// 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, subject to the following conditions:
//===- llvm/Support/VTable.h - LLVM-style vtables ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides LLVM_VIRTUAL() and related macros for creating virtual