This file contains 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
// Copyright 2021 Johan Rade ([email protected]) | |
// Distributed under the MIT license (https://opensource.org/licenses/MIT) | |
#ifndef FAST_EXP_H | |
#define FAST_EXP_H | |
#include <cstdint> | |
#include <cstring> | |
This file contains 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
// Copyright 2024 Johan Rade ([email protected]) | |
// Distributed under the MIT license (https://opensource.org/licenses/MIT) | |
inline size_t lcsDistance(const std::string& s, const std::string& t) | |
{ | |
size_t m = s.size() + 1; | |
size_t n = t.size() + 1; | |
const char* p = s.data(); | |
const char* q = t.data(); |
This file contains 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
// Copyright 2024 Johan Rade ([email protected]) | |
// Distributed under the MIT license (https://opensource.org/licenses/MIT) | |
// Single producer single consumer queue | |
// Fast and simple implementation using C++20 std::atomic<T>::wait() and std::atomic<T>::notify_one() | |
#pragma once | |
#include <atomic> | |
#include <new> |