mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-19 11:43:26 +00:00
Compare commits
5 Commits
v5.1.0.rc1
...
7ebbed6763
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ebbed6763 | |||
| e271bccaf5 | |||
| 50765f69c5 | |||
| 1169534133 | |||
| 783501aab9 |
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
open_collective: libomathorg
|
||||||
|
github: orange-cpp
|
||||||
37
CODEOWNERS
Normal file
37
CODEOWNERS
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
## List of maintainers for the omath library
|
||||||
|
|
||||||
|
## This file purpose is to give newcomers to the project the responsible
|
||||||
|
## developers when submitting a pull request on GitHub, or opening a bug
|
||||||
|
## report in issues.
|
||||||
|
|
||||||
|
## This file will notably establish who is responsible for a specific
|
||||||
|
## area of omath. Being a maintainer means the following:
|
||||||
|
## - that person has good knownledge in the area
|
||||||
|
## - that person is able to enforce consistency in the area
|
||||||
|
## - that person may be available for giving help in the area
|
||||||
|
## - that person has push access on the repository
|
||||||
|
## Being a maintainer does not mean the following:
|
||||||
|
## - that person is dedicated to the area
|
||||||
|
## - that person is working full-time on the area/on omath
|
||||||
|
## - that person is paid
|
||||||
|
## - that person is always available
|
||||||
|
|
||||||
|
|
||||||
|
# omath core source code
|
||||||
|
/source @orange-cpp
|
||||||
|
/include @orange-cpp
|
||||||
|
|
||||||
|
# Tests and becnchmarks
|
||||||
|
/benchmark @orange-cpp
|
||||||
|
/tests @orange-cpp @luadebug
|
||||||
|
|
||||||
|
# Examples and documentation
|
||||||
|
/examples @luadebug @orange-cpp
|
||||||
|
/docs @orange-cpp
|
||||||
|
|
||||||
|
# Misc like formating
|
||||||
|
/scripts @luadebug
|
||||||
|
/pixi @luadebug
|
||||||
|
|
||||||
|
# CI/CD
|
||||||
|
/.github/workflows @luadbg @orange-cpp
|
||||||
42
INSTALL.md
42
INSTALL.md
@@ -1,6 +1,6 @@
|
|||||||
# 📥Installation Guide
|
# 📥Installation Guide
|
||||||
|
|
||||||
## <img width="28px" src="https://vcpkg.io/assets/mark/mark.svg" /> Using vcpkg
|
## <img width="28px" src="https://vcpkg.io/assets/mark/mark.svg" /> Using vcpkg (recomended)
|
||||||
**Note**: Support vcpkg for package management
|
**Note**: Support vcpkg for package management
|
||||||
1. Install [vcpkg](https://github.com/microsoft/vcpkg)
|
1. Install [vcpkg](https://github.com/microsoft/vcpkg)
|
||||||
2. Run the following command to install the orange-math package:
|
2. Run the following command to install the orange-math package:
|
||||||
@@ -28,6 +28,46 @@ target("...")
|
|||||||
add_packages("omath")
|
add_packages("omath")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## <img width="28px" src="https://github.githubassets.com/favicons/favicon.svg" /> Using prebuilt binaries (GitHub Releases)
|
||||||
|
|
||||||
|
**Note**: This is the fastest option if you don’t want to build from source.
|
||||||
|
|
||||||
|
1. **Go to the Releases page**
|
||||||
|
- Open the project’s GitHub **Releases** page and choose the latest version.
|
||||||
|
|
||||||
|
2. **Download the correct asset for your platform**
|
||||||
|
- Pick the archive that matches your OS and architecture (for example: Windows x64 / Linux x64 / macOS arm64).
|
||||||
|
|
||||||
|
3. **Extract the archive**
|
||||||
|
- You should end up with something like:
|
||||||
|
- `include/` (headers)
|
||||||
|
- `lib/` or `bin/` (library files / DLLs)
|
||||||
|
- sometimes `cmake/` (CMake package config)
|
||||||
|
|
||||||
|
4. **Use it in your project**
|
||||||
|
|
||||||
|
### Option A: CMake package (recommended if the release includes CMake config files)
|
||||||
|
If the extracted folder contains something like `lib/cmake/omath` or `cmake/omath`, you can point CMake to it:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
# Example: set this to the extracted prebuilt folder
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH "path/to/omath-prebuilt")
|
||||||
|
|
||||||
|
find_package(omath CONFIG REQUIRED)
|
||||||
|
target_link_libraries(main PRIVATE omath::omath)
|
||||||
|
```
|
||||||
|
### Option B: Manual include + link (works with any layout)
|
||||||
|
If there’s no CMake package config, link it manually:
|
||||||
|
```cmake
|
||||||
|
target_include_directories(main PRIVATE "path/to/omath-prebuilt/include")
|
||||||
|
|
||||||
|
# Choose ONE depending on what you downloaded:
|
||||||
|
# - Static library: .lib / .a
|
||||||
|
# - Shared library: .dll + .lib import (Windows), .so (Linux), .dylib (macOS)
|
||||||
|
|
||||||
|
target_link_directories(main PRIVATE "path/to/omath-prebuilt/lib")
|
||||||
|
target_link_libraries(main PRIVATE omath) # or the actual library filename
|
||||||
|
```
|
||||||
## <img width="28px" src="https://upload.wikimedia.org/wikipedia/commons/e/ef/CMake_logo.svg?" /> Build from source using CMake
|
## <img width="28px" src="https://upload.wikimedia.org/wikipedia/commons/e/ef/CMake_logo.svg?" /> Build from source using CMake
|
||||||
1. **Preparation**
|
1. **Preparation**
|
||||||
|
|
||||||
|
|||||||
@@ -62,20 +62,13 @@ namespace omath::detail
|
|||||||
return splitmix64(base_seed() + 0xD1B54A32D192ED03ull * (Stream + 1));
|
return splitmix64(base_seed() + 0xD1B54A32D192ED03ull * (Stream + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
consteval std::uint64_t bounded_u64(const std::uint64_t x, const std::uint64_t bound)
|
|
||||||
{
|
|
||||||
return (x * bound) >> 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<std::int64_t Lo, std::int64_t Hi, std::uint64_t Stream>
|
template<std::int64_t Lo, std::int64_t Hi, std::uint64_t Stream>
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
consteval std::int64_t rand_uint8_t()
|
consteval std::int64_t rand_uint8_t()
|
||||||
{
|
{
|
||||||
static_assert(Lo <= Hi);
|
static_assert(Lo <= Hi);
|
||||||
const std::uint64_t span = static_cast<std::uint64_t>(Hi - Lo) + 1ull;
|
|
||||||
const std::uint64_t r = rand_u64<Stream>();
|
const std::uint64_t r = rand_u64<Stream>();
|
||||||
return static_cast<std::int64_t>(bounded_u64(r, span)) + Lo;
|
return static_cast<std::int64_t>(r) + Lo;
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
consteval std::uint64_t rand_u64(const std::uint64_t seed, const std::uint64_t i)
|
consteval std::uint64_t rand_u64(const std::uint64_t seed, const std::uint64_t i)
|
||||||
|
|||||||
Reference in New Issue
Block a user