Skip to content

Commit 359fbce

Browse files
committed
Add CREDITS.md and attribution comments in code as suggested by community
1 parent d1d35a7 commit 359fbce

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

CREDITS.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Credits and Attributions
2+
3+
This modernized fork of `pcg-cpp` by **Total-Random** integrates several critical fixes and improvements from the community. Below is a list of changes and their original sources.
4+
5+
## Community Fixes
6+
7+
### 1. Optimized `unxorshift`
8+
- **Origin:** [imneme/pcg-cpp PR #82](https://github.com/imneme/pcg-cpp/pull/82)
9+
- **Author:** [melak47](https://github.com/melak47)
10+
- **Description:** Implements a more efficient inverse xorshift operation.
11+
12+
### 2. Empty Base Class Optimization (EBCO) for MSVC
13+
- **Origin:** [imneme/pcg-cpp PR #66](https://github.com/imneme/pcg-cpp/pull/66)
14+
- **Author:** [melak47](https://github.com/melak47)
15+
- **Description:** Enables `__declspec(empty_bases)` on MSVC to optimize the memory footprint of RNG objects.
16+
17+
### 3. Public `result_type` in `seed_seq_from`
18+
- **Origin:** [imneme/pcg-cpp commit 1eeda5f](https://github.com/imneme/pcg-cpp/commit/1eeda5f893d9595a855cdfa5d53dbbdd08c091b7)
19+
- **Author:** [oneill](https://github.com/imneme) (Melissa O'Neill)
20+
- **Description:** Makes `result_type` public to comply with the C++ `SeedSequence` concept.
21+
22+
### 4. GCC Warning Fixes
23+
- **Origin:** [SupercriticalSynthesizers/pcg-cpp PR fix-gcc-warnings](https://github.com/SupercriticalSynthesizers/pcg-cpp/tree/fix-gcc-warnings)
24+
- **Author:** [Timo Alho](https://github.com/tialho)
25+
- **Description:** Resolves various GCC warnings (clz/ctz truncation) when building with `-Wall`.
26+
27+
## Total-Random Improvements
28+
29+
### 5. Native Windows ARM64 Support
30+
- **Author:** [Total-Random](https://github.com/Total-Random)
31+
- **Description:** Added native support for ARM64 on MSVC using `__umulh` for efficient 128-bit multiplication.
32+
33+
### 6. Modern CMake Build System
34+
- **Author:** [Total-Random](https://github.com/Total-Random)
35+
- **Description:** Comprehensive CMake integration with `find_package` support and automated testing via `ctest`.
36+
37+
### 7. MSVC Compatibility Fixes
38+
- **Author:** [Total-Random](https://github.com/Total-Random)
39+
- **Description:** Resolved several MSVC-specific issues:
40+
- `C2678` (ambiguous operator) in `set_stream` and `operator>>`.
41+
- `C4458` (declaration of 'is_mcg' hides class member).
42+
- `C1090` (PDB API call failed) during parallel builds.
43+
- `C4127` (conditional expression is constant) in template code.
44+
45+
## Special Thanks
46+
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.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The original repository by Melissa O'Neill (`imneme/pcg-cpp`) has been a corners
1919
- **Optimized `unxorshift`**: Implemented an optimized version of the inverse xorshift operation, improving performance for large integer types.
2020
- **Consistent Typing**: Unified integer type handling across different platforms to avoid compiler warnings and errors.
2121

22+
Detailed information about integrated community fixes and contributors can be found in [CREDITS.md](CREDITS.md).
23+
2224
## About PCG
2325

2426
PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. Unlike many common generators, it's not just "good enough" — it passes the most stringent statistical tests while being faster and smaller than most alternatives.

include/pcg_extras.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ inline std::istream& operator>>(std::istream& in, uint8_t& value)
261261
* XorShifts are invertable, but they are someting of a pain to invert.
262262
* This function backs them out. It's used by the whacky "inside out"
263263
* generator defined later.
264+
*
265+
* This optimized implementation is from imneme/pcg-cpp PR #82.
264266
*/
265267

266268
template <typename itype>
@@ -577,6 +579,7 @@ class seed_seq_from {
577579
RngType rng_;
578580

579581
public:
582+
// This fix is from imneme/pcg-cpp commit 1eeda5f
580583
typedef uint_least32_t result_type;
581584

582585
template<typename... Args>

include/pcg_random.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
#define PCG_ALWAYS_INLINE __forceinline
9898
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190024210
9999
// available since VS 2015 Update 2/3
100+
// This fix is from imneme/pcg-cpp PR #66
100101
#define PCG_EBO __declspec(empty_bases)
101102
#else
102103
#define PCG_EBO

include/pcg_uint128.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ namespace pcg_extras {
102102

103103
#if defined(__GNUC__) // Any GNU-compatible compiler supporting C++11 has
104104
// some useful intrinsics we can use.
105+
// These bitcount_t casts are from SupercriticalSynthesizers/pcg-cpp PR fix-gcc-warnings
105106

106107
inline bitcount_t flog2(uint32_t v)
107108
{

0 commit comments

Comments
 (0)