Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package pcg-c for openSUSE:Factory checked in at 2026-06-10 15:52:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pcg-c (Old) and /work/SRC/openSUSE:Factory/.pcg-c.new.2375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pcg-c" Wed Jun 10 15:52:08 2026 rev:2 rq:1358257 version:0.94.2 Changes: -------- --- /work/SRC/openSUSE:Factory/pcg-c/pcg-c.changes 2026-05-04 12:54:46.628591126 +0200 +++ /work/SRC/openSUSE:Factory/.pcg-c.new.2375/pcg-c.changes 2026-06-10 15:52:32.103181209 +0200 @@ -1,0 +2,15 @@ +Tue Jun 9 23:39:49 UTC 2026 - Andy Alt <[email protected]> + +- pcg 0.94.2 + - Fix signed integer overflow UB in `pcg_advance_lcg_8` and + `pcg_advance_lcg_16`: C's integer promotion rules convert `uint8_t`/`uint16_t` + operands to signed `int` before arithmetic; large 16-bit products exceed + `INT32_MAX`, triggering undefined behavior caught by UBSan. Cast through the + next-wider unsigned type to keep all multiplications in unsigned arithmetic. + - When built as a Meson subproject, install nothing and skip the tests/samples. + - Honour `-Ddefault_library=static` on non-Windows builds (previously always shared). + - Add a `build_samples` option (default off) to build the sample programs. + - Raise the declared Meson minimum to 0.58.0 to match features already in use + (silences a setup-time warning). + +------------------------------------------------------------------- @@ -4 +19 @@ -- pcg 0.94 +- pcg 0.94.1 Old: ---- pcg-c-0.94.1.tar.gz New: ---- pcg-c-0.94.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pcg-c.spec ++++++ --- /var/tmp/diff_new_pack.s2IEtG/_old 2026-06-10 15:52:33.907255969 +0200 +++ /var/tmp/diff_new_pack.s2IEtG/_new 2026-06-10 15:52:33.911256135 +0200 @@ -20,7 +20,7 @@ %define devname %{libname}-devel Name: pcg-c -Version: 0.94.1 +Version: 0.94.2 Release: 0 Summary: Library implementing the PCG random number generation scheme License: Apache-2.0 OR MIT ++++++ pcg-c-0.94.1.tar.gz -> pcg-c-0.94.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/.github/workflows/bsd.yml new/pcg-c-0.94.2/.github/workflows/bsd.yml --- old/pcg-c-0.94.1/.github/workflows/bsd.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pcg-c-0.94.2/.github/workflows/bsd.yml 2026-06-10 01:26:57.000000000 +0200 @@ -0,0 +1,60 @@ +name: BSD +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +on: + push: + branches: [ master ] + paths: &shared_paths + - '**' + - '!**.yml' + - '!**.md' + - '**/bsd.yml' + + pull_request: + branches: [ master ] + paths: *shared_paths + +jobs: + BSD: + name: BSD (${{ matrix.os }} ${{ matrix.version }}) + strategy: + fail-fast: false + matrix: + include: + - os: freebsd + version: '15.0' + install: sudo pkg install -y meson ninja + - os: openbsd + version: '7.9' + install: | + echo https://cdn.openbsd.org/pub/OpenBSD | sudo tee /etc/installurl + sudo pkg_add meson ninja + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Setup ${{ matrix.os }} ${{ matrix.version }} + uses: cross-platform-actions/action@v1 + with: + operating_system: ${{ matrix.os }} + version: ${{ matrix.version }} + + - name: Install dependencies + shell: cpa.sh {0} + run: ${{ matrix.install }} + + - name: Setup + shell: cpa.sh {0} + run: CFLAGS="-Werror" meson setup _build + + - name: Compile + shell: cpa.sh {0} + run: meson compile -C _build + + - name: Test and install + shell: cpa.sh {0} + run: | + meson test --no-stdsplit -v -C _build + meson install --destdir=install_test -C _build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/.github/workflows/codeql.yml new/pcg-c-0.94.2/.github/workflows/codeql.yml --- old/pcg-c-0.94.1/.github/workflows/codeql.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pcg-c-0.94.2/.github/workflows/codeql.yml 2026-06-10 01:26:57.000000000 +0200 @@ -0,0 +1,40 @@ +name: "CodeQL" + +on: + push: + branches: master + paths: + - '**.c' + - '**.h' + - '**/codeql.yml' + +# schedule: +# - cron: '0 6 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + # We must fetch at least the immediate parents so that if this is a + # pull request then we can checkout the head. + fetch-depth: 2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: 'cpp' + + - run: sudo apt-get install -y meson + - run: | + meson setup _build + ninja -C _build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/.github/workflows/linux.yml new/pcg-c-0.94.2/.github/workflows/linux.yml --- old/pcg-c-0.94.1/.github/workflows/linux.yml 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/.github/workflows/linux.yml 2026-06-10 01:26:57.000000000 +0200 @@ -37,7 +37,7 @@ run: pip install meson ninja - name: Meson setup - run: CFLAGS="-Werror" meson setup _build + run: CFLAGS="-Werror" meson setup _build -Db_sanitize=address,undefined -Db_lundef=false - name: Build run: meson compile -C _build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/.gitignore new/pcg-c-0.94.2/.gitignore --- old/pcg-c-0.94.1/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/.gitignore 2026-06-10 01:26:57.000000000 +0200 @@ -1,37 +0,0 @@ -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Debug Information -*.dSYM - -# Executables -*.exe -*.out -*.app - -# Actual Project Executables - -pcg32-demo -pcg32-global-demo -pcg32x2-demo \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/ChangeLog.md new/pcg-c-0.94.2/ChangeLog.md --- old/pcg-c-0.94.1/ChangeLog.md 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/ChangeLog.md 2026-06-10 01:26:57.000000000 +0200 @@ -1,3 +1,17 @@ +2026-06-10 + +- pcg 0.94.2: + - Fix signed integer overflow UB in `pcg_advance_lcg_8` and + `pcg_advance_lcg_16`: C's integer promotion rules convert `uint8_t`/`uint16_t` + operands to signed `int` before arithmetic; large 16-bit products exceed + `INT32_MAX`, triggering undefined behavior caught by UBSan. Cast through the + next-wider unsigned type to keep all multiplications in unsigned arithmetic. + - When built as a Meson subproject, install nothing and skip the tests/samples. + - Honour `-Ddefault_library=static` on non-Windows builds (previously always shared). + - Add a `build_samples` option (default off) to build the sample programs. + - Raise the declared Meson minimum to 0.58.0 to match features already in use + (silences a setup-time warning). + 2026-04-29 - pcg 0.94.1: @@ -12,3 +26,16 @@ `pcg_variants.h` via pragma push/pop; cast narrowing shift in `pcg_output_xsh_rr_64_32` (C4244); replace non-portable `#warning` in `pcg_spinlock.h` with `#pragma message` under MSVC + - The following are upstream fixes present in the 0.94 release that were + corrected in the upstream repository before this fork was created: + - Fix critical typo in `entropy_getbytes`: `if (fd >= 0) return false` + caused the function to always report failure when `/dev/urandom` opened + successfully, making entropy collection entirely non-functional + - Switch `entropy_getbytes` from `/dev/random` to `/dev/urandom` to avoid + blocking on entropy-starved systems + - Fix file descriptor leak and `int` vs `ssize_t` type mismatch in + `entropy_getbytes` + - Fix incorrect shift parameter in `pcg_output_xsh_rr_128_64` (`29u` → + `35u`), which produced wrong output from 128-bit XSH RR generators + - Rearrange `PCG_HAS_128BIT_OPS` guards in `pcg_variants.h` so the header + compiles on platforms without `__SIZEOF_INT128__` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/README.md new/pcg-c-0.94.2/README.md --- old/pcg-c-0.94.1/README.md 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/README.md 2026-06-10 01:26:57.000000000 +0200 @@ -2,15 +2,19 @@ [](https://github.com/andy5995/pcg-c/actions/workflows/macos.yml) [](https://github.com/andy5995/pcg-c/actions/workflows/msys2.yml) [](https://github.com/andy5995/pcg-c/actions/workflows/msvc.yml) +[](https://github.com/andy5995/pcg-c/actions/workflows/bsd.yml) This repository was forked from the original at -[](https://github.com/imneme/pcg-c/commit/83252d9c23df9c82ecb42210afed61a7b42402d7) -from the original, which had several bug fixes from the officially released -[0.94 version](https://www.pcg-random.org/download.html). The aim of this -repository is to provide a tagged version for packagers and should have -minimal changes to it. andy5995 has replaced the Makefiles with a -[mesonbuild](https://mesonbuild.com/) to also aid in packaging. +[83252d9](https://github.com/imneme/pcg-c/commit/83252d9c23df9c82ecb42210afed61a7b42402d7) +, which had several bug fixes from the officially released [0.94 +version](https://www.pcg-random.org/download.html). The aim of this repository +is to provide a tagged version for packagers and should have minimal changes +to it. andy5995 has replaced the Makefiles with a +[mesonbuild](https://mesonbuild.com/) to also aid in packaging. Installing the +library also provides a pkg-config (`.pc`) file so build systems can locate +pcg-c's headers and library automatically (e.g. `pkg-config --cflags --libs +pcg-c`). # PCG Random Number Generation, C Edition @@ -37,16 +41,16 @@ ## Building The code is written in C99-style C with no significant platform dependencies. -On a Unix-style system (e.g., Linux, Mac OS X) you should be able to just -type +With [Meson](https://mesonbuild.com/) installed, configure and build with - make + meson setup build + meson compile -C build Almost all the real code is in `include/pcg_variants.h`. Because the individual RNGs have a very small amount of code, they are provided as inline functions to allow the compiler the option of inlining them. But because C requires there to also be an external definition, the -`src` directory contains code to build `libpcg_random.a` which provides +`src` directory contains code to build `libpcg-c` which provides non-inline definitions for all the PCG generators. On other systems, it should be straightforward to build a library by @@ -57,7 +61,7 @@ Run - make test + meson test -C build ## Directory Structure @@ -88,7 +92,3 @@ The C++ implementation provides 128-bit integers even on systems that don't natively support it, but doing so would be too much trouble in C. - - - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/build-aux/check-output.py new/pcg-c-0.94.2/build-aux/check-output.py --- old/pcg-c-0.94.1/build-aux/check-output.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pcg-c-0.94.2/build-aux/check-output.py 2026-06-10 01:26:57.000000000 +0200 @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +"""Run a check program and compare its stdout against an expected-output file. + +Usage: check-output.py <program> <expected-file> + +Exits 0 if the program's stdout matches the file byte-for-byte, otherwise +prints a unified diff and exits 1. +""" +import difflib +import subprocess +import sys + +prog, expected = sys.argv[1], sys.argv[2] + +actual = subprocess.run([prog], stdout=subprocess.PIPE).stdout +with open(expected, 'rb') as f: + want = f.read() + +if actual == want: + sys.exit(0) + +sys.stdout.writelines( + difflib.unified_diff( + want.decode(errors='replace').splitlines(keepends=True), + actual.decode(errors='replace').splitlines(keepends=True), + fromfile=expected, + tofile='actual', + ) +) +sys.exit(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/meson.build new/pcg-c-0.94.2/meson.build --- old/pcg-c-0.94.1/meson.build 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/meson.build 2026-06-10 01:26:57.000000000 +0200 @@ -1,8 +1,8 @@ project( 'pcg-c', 'c', - version: '0.94.1', - meson_version: '>= 0.56.0', + version: '0.94.2', + meson_version: '>= 0.58.0', default_options: ['warning_level=2', 'c_std=c99'], ) @@ -22,81 +22,82 @@ pcg_inc = include_directories('include') -_lib_sources = files( - 'src/pcg-advance-128.c', - 'src/pcg-advance-16.c', - 'src/pcg-advance-32.c', - 'src/pcg-advance-64.c', - 'src/pcg-advance-8.c', - 'src/pcg-global-32.c', - 'src/pcg-global-64.c', - 'src/pcg-output-128.c', - 'src/pcg-output-16.c', - 'src/pcg-output-32.c', - 'src/pcg-output-64.c', - 'src/pcg-output-8.c', - 'src/pcg-rngs-128.c', - 'src/pcg-rngs-16.c', - 'src/pcg-rngs-32.c', - 'src/pcg-rngs-64.c', - 'src/pcg-rngs-8.c', -) +subdir('src') + +# As a subproject the superproject owns installation and our tests/samples are +# irrelevant, so install nothing and skip them. A standalone build installs the +# library and builds the rest. +is_standalone = not meson.is_subproject() # MSVC shared libraries require __declspec(dllexport) on every public symbol; -# build static on Windows to avoid that requirement. +# force static on Windows to avoid that requirement. Elsewhere, library() honours +# the built-in default_library option so a superproject can request a static build. if host_machine.system() == 'windows' pcg_lib = static_library( meson.project_name(), _lib_sources, include_directories: pcg_inc, - install: true, + install: is_standalone, ) else - pcg_lib = shared_library( + pcg_lib = library( meson.project_name(), _lib_sources, include_directories: pcg_inc, version: meson.project_version(), soversion: 0, - install: true, + install: is_standalone, ) endif -install_headers('include/pcg_variants.h') - pcg_dep = declare_dependency( link_with: pcg_lib, include_directories: pcg_inc, ) -pkg = import('pkgconfig') -pkg.generate( - pcg_lib, - name: meson.project_name(), - url: 'https://github.com/andy5995/pcg-c', - description: 'PCG Random Number Generation library for C', - version: meson.project_version(), - subdirs: '.', -) +if is_standalone + install_headers('include/pcg_variants.h') + + pkg = import('pkgconfig') + pkg.generate( + pcg_lib, + name: meson.project_name(), + url: 'https://github.com/andy5995/pcg-c', + description: 'PCG Random Number Generation library for C', + version: meson.project_version(), + subdirs: '.', + ) + + fs = import('fs') + doc_files = ['README.md', 'ChangeLog.md'] + # License filenames differ between the git repo and release archives, so check + # before including to allow the same meson.build to work with both. + foreach f : [ + 'LICENSE.txt', + 'LICENSE-APACHE.txt', + 'LICENSE-MIT.txt', + 'LICENSE.spdx', + 'CONTRIBUTING.md', + ] + if fs.is_file(f) + doc_files += f + endif + endforeach + install_data(doc_files, install_dir: get_option('docdir')) + + has_128bit = cc.compiles( + 'typedef __uint128_t t;', + name: '128-bit integer support', + ) -fs = import('fs') -doc_files = ['README.md', 'ChangeLog.md'] -# License filenames differ between the git repo and release archives, so check -# before including to allow the same meson.build to work with both. -foreach f : [ - 'LICENSE.txt', - 'LICENSE-APACHE.txt', - 'LICENSE-MIT.txt', - 'LICENSE.spdx', - 'CONTRIBUTING.md', -] - if fs.is_file(f) - doc_files += f + if get_option('build_tests') + # Run the comparison script with meson's own Python rather than relying on + # a python3 on PATH; the BSD CI VMs have meson but no python3 in PATH. + python = import('python').find_installation() + check_output = files('build-aux/check-output.py') + subdir('test-high') + subdir('test-low') endif -endforeach -install_data(doc_files, install_dir: get_option('docdir')) -if get_option('build_tests') - subdir('test-high') - subdir('test-low') + subdir('sample') endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/meson_options.txt new/pcg-c-0.94.2/meson_options.txt --- old/pcg-c-0.94.1/meson_options.txt 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/meson_options.txt 2026-06-10 01:26:57.000000000 +0200 @@ -6,6 +6,13 @@ ) option( + 'build_samples', + type: 'boolean', + value: false, + description: 'Build the sample programs', +) + +option( 'docdir', type: 'string', value: 'share/doc/pcg-c', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/.gitignore new/pcg-c-0.94.2/sample/.gitignore --- old/pcg-c-0.94.1/sample/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/sample/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -pcg32-demo -pcg32x2-demo -pcg64-demo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/meson.build new/pcg-c-0.94.2/sample/meson.build --- old/pcg-c-0.94.1/sample/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/pcg-c-0.94.2/sample/meson.build 2026-06-10 01:26:57.000000000 +0200 @@ -0,0 +1,18 @@ +if get_option('build_samples') + sample_names = ['pcg32-demo', 'pcg32-global-demo', 'pcg32x2-demo'] + if has_128bit + sample_names += ['pcg64-demo'] + endif + + extras_inc = include_directories('../extras') + + foreach name : sample_names + exe = executable( + name, + [name + '.c', '../extras/entropy.c'], + include_directories: extras_inc, + dependencies: pcg_dep, + ) + test(name, exe) + endforeach +endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/pcg32-demo.c new/pcg-c-0.94.2/sample/pcg32-demo.c --- old/pcg-c-0.94.1/sample/pcg32-demo.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/sample/pcg32-demo.c 2026-06-10 01:26:57.000000000 +0200 @@ -29,7 +29,7 @@ #include <stdint.h> #include <string.h> -#include "pcg_variants.h" +#include <pcg_variants.h> #include "entropy.h" /* Wrapper around /dev/random */ int main(int argc, char** argv) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/pcg32-global-demo.c new/pcg-c-0.94.2/sample/pcg32-global-demo.c --- old/pcg-c-0.94.1/sample/pcg32-global-demo.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/sample/pcg32-global-demo.c 2026-06-10 01:26:57.000000000 +0200 @@ -29,7 +29,7 @@ #include <stdint.h> #include <string.h> -#include "pcg_variants.h" +#include <pcg_variants.h> #include "entropy.h" /* Wrapper around /dev/random */ int main(int argc, char** argv) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/pcg32x2-demo.c new/pcg-c-0.94.2/sample/pcg32x2-demo.c --- old/pcg-c-0.94.1/sample/pcg32x2-demo.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/sample/pcg32x2-demo.c 2026-06-10 01:26:57.000000000 +0200 @@ -29,7 +29,7 @@ #include <stdint.h> #include <string.h> -#include "pcg_variants.h" +#include <pcg_variants.h> #include "entropy.h" /* Wrapper around /dev/random */ /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/sample/pcg64-demo.c new/pcg-c-0.94.2/sample/pcg64-demo.c --- old/pcg-c-0.94.1/sample/pcg64-demo.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/sample/pcg64-demo.c 2026-06-10 01:26:57.000000000 +0200 @@ -29,7 +29,7 @@ #include <stdint.h> #include <string.h> -#include "pcg_variants.h" +#include <pcg_variants.h> #include "entropy.h" /* Wrapper around /dev/random */ int main(int argc, char** argv) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/src/meson.build new/pcg-c-0.94.2/src/meson.build --- old/pcg-c-0.94.1/src/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/pcg-c-0.94.2/src/meson.build 2026-06-10 01:26:57.000000000 +0200 @@ -0,0 +1,19 @@ +_lib_sources = files( + 'pcg-advance-128.c', + 'pcg-advance-16.c', + 'pcg-advance-32.c', + 'pcg-advance-64.c', + 'pcg-advance-8.c', + 'pcg-global-32.c', + 'pcg-global-64.c', + 'pcg-output-128.c', + 'pcg-output-16.c', + 'pcg-output-32.c', + 'pcg-output-64.c', + 'pcg-output-8.c', + 'pcg-rngs-128.c', + 'pcg-rngs-16.c', + 'pcg-rngs-32.c', + 'pcg-rngs-64.c', + 'pcg-rngs-8.c', +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/src/pcg-advance-16.c new/pcg-c-0.94.2/src/pcg-advance-16.c --- old/pcg-c-0.94.1/src/pcg-advance-16.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/src/pcg-advance-16.c 2026-06-10 01:26:57.000000000 +0200 @@ -48,13 +48,13 @@ uint16_t acc_plus = 0u; while (delta > 0) { if (delta & 1) { - acc_mult *= cur_mult; - acc_plus = acc_plus * cur_mult + cur_plus; + acc_mult = (uint16_t)((uint32_t)acc_mult * cur_mult); + acc_plus = (uint16_t)((uint32_t)acc_plus * cur_mult + cur_plus); } - cur_plus = (cur_mult + 1) * cur_plus; - cur_mult *= cur_mult; + cur_plus = (uint16_t)((uint32_t)(cur_mult + 1u) * cur_plus); + cur_mult = (uint16_t)((uint32_t)cur_mult * cur_mult); delta /= 2; } - return acc_mult * state + acc_plus; + return (uint16_t)((uint32_t)acc_mult * state + acc_plus); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/src/pcg-advance-8.c new/pcg-c-0.94.2/src/pcg-advance-8.c --- old/pcg-c-0.94.1/src/pcg-advance-8.c 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/src/pcg-advance-8.c 2026-06-10 01:26:57.000000000 +0200 @@ -48,13 +48,13 @@ uint8_t acc_plus = 0u; while (delta > 0) { if (delta & 1) { - acc_mult *= cur_mult; - acc_plus = acc_plus * cur_mult + cur_plus; + acc_mult = (uint8_t)((uint16_t)acc_mult * cur_mult); + acc_plus = (uint8_t)((uint16_t)acc_plus * cur_mult + cur_plus); } - cur_plus = (cur_mult + 1) * cur_plus; - cur_mult *= cur_mult; + cur_plus = (uint8_t)((uint16_t)(cur_mult + 1u) * cur_plus); + cur_mult = (uint8_t)((uint16_t)cur_mult * cur_mult); delta /= 2; } - return acc_mult * state + acc_plus; + return (uint8_t)((uint16_t)acc_mult * state + acc_plus); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-high/.gitignore new/pcg-c-0.94.2/test-high/.gitignore --- old/pcg-c-0.94.1/test-high/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-high/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# Executables -check-pcg8i -check-pcg8si -check-pcg16i -check-pcg16si -check-pcg32 -check-pcg32-global -check-pcg32f -check-pcg32i -check-pcg32s -check-pcg32si -check-pcg32u -check-pcg64 -check-pcg64-global -check-pcg64f -check-pcg64i -check-pcg64s -check-pcg64si -check-pcg64u -check-pcg128i -check-pcg128si diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-high/expected/.gitignore new/pcg-c-0.94.2/test-high/expected/.gitignore --- old/pcg-c-0.94.1/test-high/expected/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-high/expected/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -# These .out files shouldn't be ignored -!*.out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-high/meson.build new/pcg-c-0.94.2/test-high/meson.build --- old/pcg-c-0.94.1/test-high/meson.build 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-high/meson.build 2026-06-10 01:26:57.000000000 +0200 @@ -1,9 +1,4 @@ fs = import('fs') -sh = find_program('sh') -has_128bit = cc.compiles( - 'typedef __uint128_t t;', - name: '128-bit integer support', -) test_inc = include_directories('.', '../extras') @@ -49,8 +44,7 @@ expected = meson.current_source_dir() / 'expected' / name + '.out' if fs.is_file(expected) - test(name, sh, args: ['-c', - 'tmp=$(mktemp) && ' + exe.full_path().replace('\\', '/') + ' > "$tmp" && diff "$tmp" ' + expected.replace('\\', '/') + '; rc=$?; rm -f "$tmp"; exit $rc']) + test(name, python, args: [check_output, exe, expected]) else test(name, exe) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-high/run-tests.sh new/pcg-c-0.94.2/test-high/run-tests.sh --- old/pcg-c-0.94.1/test-high/run-tests.sh 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-high/run-tests.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,70 +0,0 @@ -#!/bin/sh -# -# PCG Random Number Generation for C. -# -# Copyright 2014-2017 Melissa O'Neill <[email protected]>, -# and the PCG Project contributors. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) -# -# Licensed under the Apache License, Version 2.0 (provided in -# LICENSE-APACHE.txt and at http://www.apache.org/licenses/LICENSE-2.0) -# or under the MIT license (provided in LICENSE-MIT.txt and at -# http://opensource.org/licenses/MIT), at your option. This file may not -# be copied, modified, or distributed except according to those terms. -# -# Distributed on an "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, either -# express or implied. See your chosen license for details. -# -# For additional information about the PCG random number generation scheme, -# visit http://www.pcg-random.org/. -# - -echo Performing a quick sanity check... - -mkdir -p actual -rm -f actual/* - -./check-pcg32-global > actual/check-pcg32-global.out -./check-pcg64-global > actual/check-pcg64-global.out - -./check-pcg8i > actual/check-pcg8i.out -./check-pcg8si > actual/check-pcg8si.out - -./check-pcg16i > actual/check-pcg16i.out -./check-pcg16si > actual/check-pcg16si.out - -./check-pcg32si > actual/check-pcg32si.out -./check-pcg32i > actual/check-pcg32i.out - -./check-pcg32 > actual/check-pcg32.out -./check-pcg32f > actual/check-pcg32f.out -./check-pcg32s > actual/check-pcg32s.out -./check-pcg32u > /dev/null - -./check-pcg64si > actual/check-pcg64si.out -./check-pcg64i > actual/check-pcg64i.out - -./check-pcg64 > actual/check-pcg64.out -./check-pcg64f > actual/check-pcg64f.out -./check-pcg64s > actual/check-pcg64s.out -./check-pcg64u > /dev/null - -./check-pcg128i > actual/check-pcg128i.out -./check-pcg128si > actual/check-pcg128si.out - -find actual -type f -size -64c -delete - -if diff -x .gitignore -ru expected actual -then - echo All tests succeeded. -else - echo '' - if diff -x "*-pcg64[fsu].out" -x "*-pcg64-global.out" -x "*-pcg64.out" \ - -x "*-pcg128*.out" -x .gitignore -ru expected actual > /dev/null - then - echo All tests except tests requiring 128-bit math succceed. - else - echo ERROR: Some tests failed. - fi -fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-low/.gitignore new/pcg-c-0.94.2/test-low/.gitignore --- old/pcg-c-0.94.1/test-low/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-low/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,78 +0,0 @@ -# Executables -check-mcg-128-rxs-m-64 -check-mcg-128-xsh-rr-64 -check-mcg-128-xsh-rs-64 -check-mcg-128-xsl-rr-64 -check-mcg-16-rxs-m-8 -check-mcg-16-xsh-rr-8 -check-mcg-16-xsh-rs-8 -check-mcg-32-rxs-m-16 -check-mcg-32-xsh-rr-16 -check-mcg-32-xsh-rs-16 -check-mcg-64-rxs-m-32 -check-mcg-64-xsh-rr-32 -check-mcg-64-xsh-rs-32 -check-mcg-64-xsl-rr-32 -check-oneseq-128-rxs-m-64 -check-oneseq-128-rxs-m-xs-128 -check-oneseq-128-xsh-rr-64 -check-oneseq-128-xsh-rs-64 -check-oneseq-128-xsl-rr-64 -check-oneseq-128-xsl-rr-rr-128 -check-oneseq-16-rxs-m-8 -check-oneseq-16-rxs-m-xs-16 -check-oneseq-16-xsh-rr-8 -check-oneseq-16-xsh-rs-8 -check-oneseq-32-rxs-m-16 -check-oneseq-32-rxs-m-xs-32 -check-oneseq-32-xsh-rr-16 -check-oneseq-32-xsh-rs-16 -check-oneseq-64-rxs-m-32 -check-oneseq-64-rxs-m-xs-64 -check-oneseq-64-xsh-rr-32 -check-oneseq-64-xsh-rs-32 -check-oneseq-64-xsl-rr-32 -check-oneseq-64-xsl-rr-rr-64 -check-oneseq-8-rxs-m-xs-8 -check-setseq-128-rxs-m-64 -check-setseq-128-rxs-m-xs-128 -check-setseq-128-xsh-rr-64 -check-setseq-128-xsh-rs-64 -check-setseq-128-xsl-rr-64 -check-setseq-128-xsl-rr-rr-128 -check-setseq-16-rxs-m-8 -check-setseq-16-rxs-m-xs-16 -check-setseq-16-xsh-rr-8 -check-setseq-16-xsh-rs-8 -check-setseq-32-rxs-m-16 -check-setseq-32-rxs-m-xs-32 -check-setseq-32-xsh-rr-16 -check-setseq-32-xsh-rs-16 -check-setseq-64-rxs-m-32 -check-setseq-64-rxs-m-xs-64 -check-setseq-64-xsh-rr-32 -check-setseq-64-xsh-rs-32 -check-setseq-64-xsl-rr-32 -check-setseq-64-xsl-rr-rr-64 -check-setseq-8-rxs-m-xs-8 -check-unique-128-rxs-m-64 -check-unique-128-rxs-m-xs-128 -check-unique-128-xsh-rr-64 -check-unique-128-xsh-rs-64 -check-unique-128-xsl-rr-64 -check-unique-128-xsl-rr-rr-128 -check-unique-16-rxs-m-8 -check-unique-16-rxs-m-xs-16 -check-unique-16-xsh-rr-8 -check-unique-16-xsh-rs-8 -check-unique-32-rxs-m-16 -check-unique-32-rxs-m-xs-32 -check-unique-32-xsh-rr-16 -check-unique-32-xsh-rs-16 -check-unique-64-rxs-m-32 -check-unique-64-rxs-m-xs-64 -check-unique-64-xsh-rr-32 -check-unique-64-xsh-rs-32 -check-unique-64-xsl-rr-32 -check-unique-64-xsl-rr-rr-64 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-low/expected/.gitignore new/pcg-c-0.94.2/test-low/expected/.gitignore --- old/pcg-c-0.94.1/test-low/expected/.gitignore 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-low/expected/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -# These .out files shouldn't be ignored -!*.out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-low/meson.build new/pcg-c-0.94.2/test-low/meson.build --- old/pcg-c-0.94.1/test-low/meson.build 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-low/meson.build 2026-06-10 01:26:57.000000000 +0200 @@ -1,9 +1,4 @@ fs = import('fs') -sh = find_program('sh') -has_128bit = cc.compiles( - 'typedef __uint128_t t;', - name: '128-bit integer support', -) test_inc = include_directories('.', '../extras') @@ -105,8 +100,7 @@ expected = meson.current_source_dir() / 'expected' / name + '.out' if fs.is_file(expected) - test(name, sh, args: ['-c', - 'tmp=$(mktemp) && ' + exe.full_path().replace('\\', '/') + ' > "$tmp" && diff "$tmp" ' + expected.replace('\\', '/') + '; rc=$?; rm -f "$tmp"; exit $rc']) + test(name, python, args: [check_output, exe, expected]) else test(name, exe) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pcg-c-0.94.1/test-low/run-tests.sh new/pcg-c-0.94.2/test-low/run-tests.sh --- old/pcg-c-0.94.1/test-low/run-tests.sh 2026-04-30 05:51:20.000000000 +0200 +++ new/pcg-c-0.94.2/test-low/run-tests.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,152 +0,0 @@ -#!/bin/sh -# -# PCG Random Number Generation for C. -# -# Copyright 2014-2017 Melissa O'Neill <[email protected]>, -# and the PCG Project contributors. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) -# -# Licensed under the Apache License, Version 2.0 (provided in -# LICENSE-APACHE.txt and at http://www.apache.org/licenses/LICENSE-2.0) -# or under the MIT license (provided in LICENSE-MIT.txt and at -# http://opensource.org/licenses/MIT), at your option. This file may not -# be copied, modified, or distributed except according to those terms. -# -# Distributed on an "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, either -# express or implied. See your chosen license for details. -# -# For additional information about the PCG random number generation scheme, -# visit http://www.pcg-random.org/. -# - -echo Performing a quick sanity check... - -mkdir -p actual -rm -f actual/* - -# Setseq - -./check-setseq-8-rxs-m-xs-8 > actual/check-setseq-8-rxs-m-xs-8.out -./check-setseq-16-xsh-rr-8 > actual/check-setseq-16-xsh-rr-8.out -./check-setseq-16-xsh-rs-8 > actual/check-setseq-16-xsh-rs-8.out -./check-setseq-16-rxs-m-xs-16 > actual/check-setseq-16-rxs-m-xs-16.out -./check-setseq-16-rxs-m-8 > actual/check-setseq-16-rxs-m-8.out -./check-setseq-32-xsh-rr-16 > actual/check-setseq-32-xsh-rr-16.out -./check-setseq-32-xsh-rs-16 > actual/check-setseq-32-xsh-rs-16.out -./check-setseq-32-rxs-m-xs-32 > actual/check-setseq-32-rxs-m-xs-32.out -./check-setseq-32-rxs-m-16 > actual/check-setseq-32-rxs-m-16.out -./check-setseq-64-xsh-rr-32 > actual/check-setseq-64-xsh-rr-32.out -./check-setseq-64-xsh-rs-32 > actual/check-setseq-64-xsh-rs-32.out -./check-setseq-64-xsl-rr-32 > actual/check-setseq-64-xsl-rr-32.out -./check-setseq-64-rxs-m-xs-64 > actual/check-setseq-64-rxs-m-xs-64.out -./check-setseq-64-rxs-m-32 > actual/check-setseq-64-rxs-m-32.out -./check-setseq-64-xsl-rr-rr-64 > actual/check-setseq-64-xsl-rr-rr-64.out -./check-setseq-128-xsh-rr-64 > actual/check-setseq-128-xsh-rr-64.out -./check-setseq-128-xsh-rs-64 > actual/check-setseq-128-xsh-rs-64.out -./check-setseq-128-xsl-rr-64 > actual/check-setseq-128-xsl-rr-64.out -./check-setseq-128-rxs-m-xs-128 > actual/check-setseq-128-rxs-m-xs-128.out -./check-setseq-128-rxs-m-64 > actual/check-setseq-128-rxs-m-64.out -./check-setseq-128-xsl-rr-rr-128 > actual/check-setseq-128-xsl-rr-rr-128.out - -# Oneseq - -./check-oneseq-8-rxs-m-xs-8 > actual/check-oneseq-8-rxs-m-xs-8.out -./check-oneseq-16-xsh-rr-8 > actual/check-oneseq-16-xsh-rr-8.out -./check-oneseq-16-xsh-rs-8 > actual/check-oneseq-16-xsh-rs-8.out -./check-oneseq-16-rxs-m-xs-16 > actual/check-oneseq-16-rxs-m-xs-16.out -./check-oneseq-16-rxs-m-8 > actual/check-oneseq-16-rxs-m-8.out -./check-oneseq-32-xsh-rr-16 > actual/check-oneseq-32-xsh-rr-16.out -./check-oneseq-32-xsh-rs-16 > actual/check-oneseq-32-xsh-rs-16.out -./check-oneseq-32-rxs-m-xs-32 > actual/check-oneseq-32-rxs-m-xs-32.out -./check-oneseq-32-rxs-m-16 > actual/check-oneseq-32-rxs-m-16.out -./check-oneseq-64-xsh-rr-32 > actual/check-oneseq-64-xsh-rr-32.out -./check-oneseq-64-xsh-rs-32 > actual/check-oneseq-64-xsh-rs-32.out -./check-oneseq-64-xsl-rr-32 > actual/check-oneseq-64-xsl-rr-32.out -./check-oneseq-64-rxs-m-xs-64 > actual/check-oneseq-64-rxs-m-xs-64.out -./check-oneseq-64-rxs-m-32 > actual/check-oneseq-64-rxs-m-32.out -./check-oneseq-64-xsl-rr-rr-64 > actual/check-oneseq-64-xsl-rr-rr-64.out -./check-oneseq-128-xsh-rr-64 > actual/check-oneseq-128-xsh-rr-64.out -./check-oneseq-128-xsh-rs-64 > actual/check-oneseq-128-xsh-rs-64.out -./check-oneseq-128-xsl-rr-64 > actual/check-oneseq-128-xsl-rr-64.out -./check-oneseq-128-rxs-m-xs-128 > actual/check-oneseq-128-rxs-m-xs-128.out -./check-oneseq-128-rxs-m-64 > actual/check-oneseq-128-rxs-m-64.out -./check-oneseq-128-xsl-rr-rr-128 > actual/check-oneseq-128-xsl-rr-rr-128.out - -# MCG - -./check-mcg-16-xsh-rr-8 > actual/check-mcg-16-xsh-rr-8.out -./check-mcg-16-xsh-rs-8 > actual/check-mcg-16-xsh-rs-8.out -./check-mcg-16-rxs-m-8 > actual/check-mcg-16-rxs-m-8.out -./check-mcg-32-xsh-rr-16 > actual/check-mcg-32-xsh-rr-16.out -./check-mcg-32-xsh-rs-16 > actual/check-mcg-32-xsh-rs-16.out -./check-mcg-32-rxs-m-16 > actual/check-mcg-32-rxs-m-16.out -./check-mcg-64-xsh-rr-32 > actual/check-mcg-64-xsh-rr-32.out -./check-mcg-64-xsh-rs-32 > actual/check-mcg-64-xsh-rs-32.out -./check-mcg-64-rxs-m-32 > actual/check-mcg-64-rxs-m-32.out -./check-mcg-64-xsl-rr-32 > actual/check-mcg-64-xsl-rr-32.out -./check-mcg-128-xsh-rr-64 > actual/check-mcg-128-xsh-rr-64.out -./check-mcg-128-xsh-rs-64 > actual/check-mcg-128-xsh-rs-64.out -./check-mcg-128-rxs-m-64 > actual/check-mcg-128-rxs-m-64.out -./check-mcg-128-xsl-rr-64 > actual/check-mcg-128-xsl-rr-64.out - -# Unique - -# The unique versions produce different outputs every run, so cannot be -# checked this way -# ./check-unique-16-xsh-rr-8 > actual/check-unique-16-xsh-rr-8.out -# ./check-unique-16-xsh-rs-8 > actual/check-unique-16-xsh-rs-8.out -# ./check-unique-16-rxs-m-xs-16 > actual/check-unique-16-rxs-m-xs-16.out -# ./check-unique-16-rxs-m-8 > actual/check-unique-16-rxs-m-8.out -# ./check-unique-32-xsh-rr-16 > actual/check-unique-32-xsh-rr-16.out -# ./check-unique-32-xsh-rs-16 > actual/check-unique-32-xsh-rs-16.out -# ./check-unique-32-rxs-m-xs-32 > actual/check-unique-32-rxs-m-xs-32.out -# ./check-unique-32-rxs-m-16 > actual/check-unique-32-rxs-m-16.out -# ./check-unique-64-xsh-rr-32 > actual/check-unique-64-xsh-rr-32.out -# ./check-unique-64-xsh-rs-32 > actual/check-unique-64-xsh-rs-32.out -# ./check-unique-64-xsl-rr-32 > actual/check-unique-64-xsl-rr-32.out -# ./check-unique-64-rxs-m-xs-64 > actual/check-unique-64-rxs-m-xs-64.out -# ./check-unique-64-rxs-m-32 > actual/check-unique-64-rxs-m-32.out -# ./check-unique-64-xsl-rr-rr-64 > actual/check-unique-64-xsl-rr-rr-64.out -# ./check-unique-128-xsh-rr-64 > actual/check-unique-128-xsh-rr-64.out -# ./check-unique-128-xsh-rs-64 > actual/check-unique-128-xsh-rs-64.out -# ./check-unique-128-xsl-rr-64 > actual/check-unique-128-xsl-rr-64.out -# ./check-unique-128-rxs-m-xs-128 > actual/check-unique-128-rxs-m-xs-128.out -# ./check-unique-128-rxs-m-64 > actual/check-unique-128-rxs-m-64.out -# ./check-unique-128-xsl-rr-rr-128 > actual/check-unique-128-xsl-rr-rr-128.out - -./check-unique-16-xsh-rr-8 > /dev/null -./check-unique-16-xsh-rs-8 > /dev/null -./check-unique-16-rxs-m-xs-16 > /dev/null -./check-unique-16-rxs-m-8 > /dev/null -./check-unique-32-xsh-rr-16 > /dev/null -./check-unique-32-xsh-rs-16 > /dev/null -./check-unique-32-rxs-m-xs-32 > /dev/null -./check-unique-32-rxs-m-16 > /dev/null -./check-unique-64-xsh-rr-32 > /dev/null -./check-unique-64-xsh-rs-32 > /dev/null -./check-unique-64-xsl-rr-32 > /dev/null -./check-unique-64-rxs-m-xs-64 > /dev/null -./check-unique-64-rxs-m-32 > /dev/null -./check-unique-64-xsl-rr-rr-64 > /dev/null -./check-unique-128-xsh-rr-64 > /dev/null -./check-unique-128-xsh-rs-64 > /dev/null -./check-unique-128-xsl-rr-64 > /dev/null -./check-unique-128-rxs-m-xs-128 > /dev/null -./check-unique-128-rxs-m-64 > /dev/null -./check-unique-128-xsl-rr-rr-128 > /dev/null - -find actual -type f -size -64c -delete - -if diff -x .gitignore -ru expected actual -then - echo All tests succeeded. -else - echo '' - if diff -x "*-128-*" -x .gitignore -ru expected actual > /dev/null - then - echo All tests except 128-bit tests succceed. - else - echo ERROR: Some tests failed. - fi -fi
