From 72e3c5429c06cc3873b452c67e709aba1f0b24f8 Mon Sep 17 00:00:00 2001 From: planet36 Date: Tue, 6 Sep 2022 20:57:31 -0500 Subject: [PATCH 1/4] Fix format warning Use macro constant PRIx64 instead of "llx" to fix the following warning. ``` pcg32x2-demo.c: In function 'main': pcg32x2-demo.c:156:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'uint64_t' {aka 'long unsigned int'} [-Wformat=] 156 | printf(" 0x%016llx", pcg32x2_random_r(&rng)); | ~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~ | | | | | uint64_t {aka long unsigned int} | long long unsigned int | %016lx ``` --- pcg32x2-demo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcg32x2-demo.c b/pcg32x2-demo.c index f2d820f..7149b3e 100644 --- a/pcg32x2-demo.c +++ b/pcg32x2-demo.c @@ -25,6 +25,7 @@ * This file was mechanically generated from tests/check-pcg32.c */ +#include #include #include #include @@ -152,7 +153,7 @@ int main(int argc, char** argv) for (i = 0; i < 6; ++i) { if (i > 0 && i % 3 == 0) printf("\n\t"); - printf(" 0x%016llx", pcg32x2_random_r(&rng)); + printf(" 0x%016" PRIx64, pcg32x2_random_r(&rng)); } printf("\n"); From 2b821b21aac17f790f4b7be035e9998c205ed457 Mon Sep 17 00:00:00 2001 From: planet36 Date: Tue, 6 Sep 2022 21:00:49 -0500 Subject: [PATCH 2/4] Sort #include directives --- pcg32x2-demo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pcg32x2-demo.c b/pcg32x2-demo.c index 7149b3e..50cd8ba 100644 --- a/pcg32x2-demo.c +++ b/pcg32x2-demo.c @@ -26,13 +26,13 @@ */ #include -#include +#include #include -#include #include -#include -#include +#include +#include #include +#include #include "pcg_basic.h" From 66ea28312a1e132967777acc8c8f0d1bd3f79a2f Mon Sep 17 00:00:00 2001 From: planet36 Date: Tue, 6 Sep 2022 21:01:33 -0500 Subject: [PATCH 3/4] Change C89 to C99 Fixed width integer types were added in C99. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index da48795..1a6a0c5 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ at the sample code -- hopefully it should be fairly self explanatory. There is no library to build. Just use the code. You can however build the three demo programs. -The code is written in C89-style C with no significant platform dependencies. +The code is written in C99-style C with no significant platform dependencies. On a Unix-style system (e.g., Linux, Mac OS X), or any system with `make`, you should be able to just type type @@ -52,4 +52,4 @@ To produce different output, run ./pcg32-demo -r You can also pass an integer count to specify how may rounds of output you -would like. \ No newline at end of file +would like. From 45ffaaa3b0f64528c2aa1561be030e127b4d1f1b Mon Sep 17 00:00:00 2001 From: planet36 Date: Tue, 6 Sep 2022 21:03:03 -0500 Subject: [PATCH 4/4] Add newline at end of file --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7fae9e0..9a28a81 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,4 @@ pcg32-demo pcg32-global-demo -pcg32x2-demo \ No newline at end of file +pcg32x2-demo