Skip to content

Commit 0d918d9

Browse files
committed
Update documentation: Add Modern C++ Best Practices (Phase 1) to CREDITS and README.
1 parent 178532b commit 0d918d9

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

CREDITS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,88 @@ This modernized fork of `pcg-cpp` by **Total-Random** integrates several critica
55
## Community Fixes
66

77
### 1. Optimized `unxorshift`
8+
89
- **Origin:** [imneme/pcg-cpp PR #82](https://github.com/imneme/pcg-cpp/pull/82)
910
- **Author:** [LRFLEW](https://github.com/LRFLEW)
1011
- **Description:** Implements a more efficient inverse xorshift operation.
1112

1213
### 2. Empty Base Class Optimization (EBCO) for MSVC
14+
1315
- **Origin:** [imneme/pcg-cpp PR #66](https://github.com/imneme/pcg-cpp/pull/66)
1416
- **Author:** [melak47](https://github.com/melak47)
1517
- **Description:** Enables `__declspec(empty_bases)` on MSVC to optimize the memory footprint of RNG objects.
1618

1719
### 3. Public `result_type` in `seed_seq_from`
20+
1821
- **Origin:** [imneme/pcg-cpp PR #83](https://github.com/imneme/pcg-cpp/pull/83)
1922
- **Author:** [timo-eichhorn](https://github.com/timo-eichhorn)
2023
- **Description:** Makes `result_type` public to comply with the C++ `SeedSequence` concept.
2124

2225
### 4. GCC Warning Fixes
26+
2327
- **Origin:** [SupercriticalSynthesizers/pcg-cpp PR fix-gcc-warnings](https://github.com/SupercriticalSynthesizers/pcg-cpp/tree/fix-gcc-warnings)
2428
- **Author:** [Timo Alho](https://github.com/tialho)
2529
- **Description:** Resolves various GCC warnings (clz/ctz truncation) when building with `-Wall`.
2630

2731
### 5. Native Windows ARM64 Support
32+
2833
- **Origin:** [imneme/pcg-cpp PR #99](https://github.com/imneme/pcg-cpp/pull/99)
2934
- **Author:** [Demonese](https://github.com/Demonese)
3035
- **Description:** Added native support for ARM64 on MSVC using `__umulh` for efficient 128-bit multiplication.
3136

3237
### 6. Sample and Include Cleanups
38+
3339
- **Origin:** [imneme/pcg-cpp commit be22608](https://github.com/imneme/pcg-cpp/commit/be22608ebcbe3aa0606600975705e2820600ed4e)
3440
- **Author:** [brt-v](https://github.com/brt-v)
3541
- **Description:** Simplified header includes in sample programs and added `basic_usage.cpp` sample.
42+
3643
### 7. Consistent Integer Type
44+
3745
- **Origin:** [imneme/pcg-cpp PR #92](https://github.com/imneme/pcg-cpp/pull/92)
3846
- **Author:** [rstub](https://github.com/rstub)
3947
- **Description:** Fixes compilation issues where `__uint128` isn't available by ensuring consistent type usage.
4048

4149
### 8. Modern C++ Standard Usage in Samples
50+
4251
- **Suggestion:** [david-fong](https://github.com/david-fong)
4352
- **Description:** Replaced C-style casting and `std::round` with `std::lround` in `cppref-sample.cpp`.
4453

4554
### 9. Rotation Inference Fix
55+
4656
- **Origin:** [imneme/pcg-cpp PR #87](https://github.com/imneme/pcg-cpp/pull/87)
4757
- **Author:** [rnvannatta](https://github.com/rnvannatta)
4858
- **Description:** Fixed rotation functions to rely on compiler idiom recognition instead of undefined behavior for 0-shift.
4959

5060
## Total-Random Improvements
5161

5262
### 10. Modern CMake Build System
63+
5364
- **Author:** [Total-Random](https://github.com/Total-Random)
5465
- **Description:** Comprehensive CMake integration with `find_package` support and automated testing via `ctest`.
5566

5667
### 11. MSVC Compatibility Fixes
68+
5769
- **Author:** [Total-Random](https://github.com/Total-Random)
5870
- **Description:** Resolved several MSVC-specific issues:
5971
- `C2678` (ambiguous operator) in `set_stream` and `operator>>`.
6072
- `C4458` (declaration of 'is_mcg' hides class member).
6173
- `C1090` (PDB API call failed) during parallel builds.
6274
- `C4127` (conditional expression is constant) in template code.
6375

76+
### 12. Modern C++ Best Practices (Phase 1)
77+
78+
- **Author:** [Total-Random](https://github.com/Total-Random)
79+
- **Description:** Updated the codebase to modern standards while maintaining full backward compatibility:
80+
- Replaced legacy `typedef` with modern `using` declarations.
81+
- Added `#pragma once` to all headers for faster compilation.
82+
- Introduced `PCG_NODISCARD` macro for results of critical functions.
83+
- Added convenience typedefs for the high-performance **DXSM** generators.
84+
6485
## Special Thanks
86+
6587
Special thanks to **Melissa O'Neill** for creating the original PCG library and to all the community members who have proposed fixes over the years.
6688

6789
We are especially grateful to:
90+
6891
- **Ben Haller** ([bhaller](https://github.com/bhaller)) for his early support, encouragement, and understanding during the initial phases of this fork.
6992
- **david-fong** ([david-fong](https://github.com/david-fong)) for valuable feedback on the CMake build system.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ The original repository by Melissa O'Neill (`imneme/pcg-cpp`) has been a corners
1818
- **Windows ARM64 Support**: Integrated native support for MSVC on ARM64 architectures (Surface Pro, Apple Silicon via VM, etc.) using `__umulh` intrinsics.
1919
- **Improved MSVC Compatibility**: Fixed ambiguous operator errors (`C2678`) in `set_stream` and `operator>>`.
2020
- **Optimized `unxorshift`**: Integrated an optimized version of the inverse xorshift operation for better performance.
21+
- **Modern C++ Style**: Replaced legacy `typedef` with modern `using` declarations and added `#pragma once`.
22+
- **Improved Safety**: Introduced `PCG_NODISCARD` to prevent errors from ignored RNG results.
23+
- **Enhanced API**: Added convenience typedefs for **DXSM** (Double XorShift Multiply) generators.
2124
- **Consistent Typing**: Unified integer type handling across different platforms to avoid compiler warnings and errors.
2225

2326
Detailed information about integrated community fixes and contributors can be found in [CREDITS.md](CREDITS.md).

0 commit comments

Comments
 (0)