diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 470dac77..78f11174 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -3,8 +3,8 @@ name: C++ CI on: [push] jobs: - build-ubuntu-gcc-13: - runs-on: ubuntu-latest + build-ubuntu-gcc-14: + runs-on: ubuntu-24.02 strategy: matrix: config: @@ -13,14 +13,14 @@ jobs: - {compiler-options: "-fanalyzer -Wno-analyzer-null-dereference -std=c++23"} steps: - uses: actions/checkout@v2 - - name: install g++ - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get install g++-13 +# - name: install g++ +# run: | +# sudo add-apt-repository ppa:ubuntu-toolchain-r/test +# sudo apt-get install g++-14 - name: compile run: | cd cpp - find . -name '*.cpp' -print0 | xargs -n1 -0 g++-13 ${{ matrix.config.compiler-options }} + find . -name '*.cpp' -print0 | xargs -n1 -0 g++-14 ${{ matrix.config.compiler-options }} build-ubuntu-clang: runs-on: ubuntu-latest @@ -29,12 +29,12 @@ jobs: - name: install clang run: | sudo apt-key adv --fetch-keys https://apt.llvm.org/llvm-snapshot.gpg.key - sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" - sudo apt-get install clang-17 + sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" + sudo apt-get install clang-18 - name: compile run: | cd cpp - find . -name '*.cpp' -print0 | xargs -n1 -0 clang++-17 -Wall -Wextra -std=c++2b + find . -name '*.cpp' -print0 | xargs -n1 -0 clang++-18 -Wall -Wextra -std=c++23 build-macos-clang: runs-on: macos-latest @@ -49,7 +49,7 @@ jobs: run: | cd cpp mkdir bits - echo $'#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n' > bits/stdc++.h + echo $'#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n' > bits/stdc++.h find . -name '*.cpp' -print0 | xargs -n1 -0 clang++ ${{ matrix.config.compiler-options }} . build-windows-visual-cpp-17: diff --git a/cpp/numbertheory/discrete_root.cpp b/cpp/numbertheory/discrete_root.cpp index e3293611..7ce2dcc4 100644 --- a/cpp/numbertheory/discrete_root.cpp +++ b/cpp/numbertheory/discrete_root.cpp @@ -12,7 +12,7 @@ int pow_mod(int x, int n, int mod) { return res; } -int generator(int m) { +int calc_generator(int m) { if (m == 2) return 1; vector factors; @@ -43,7 +43,7 @@ int generator(int m) { int discrete_root(int a, int b, int m) { if (a == 0) return -1; - int g = generator(m); + int g = calc_generator(m); int sq = (int)sqrt(m) + 1; vector> dec(sq); for (int i = 1; i <= sq; ++i) diff --git a/cpp/numbertheory/primitive_root.cpp b/cpp/numbertheory/primitive_root.cpp index 1f138efc..b9f26510 100644 --- a/cpp/numbertheory/primitive_root.cpp +++ b/cpp/numbertheory/primitive_root.cpp @@ -28,7 +28,7 @@ int totient_function(int n) { // returns g such that g^i runs through all numbers from 1 to m-1 modulo m // g exists for m = 2,4,p^a,2*p^a, where p > 2 is a prime number // O(m^0.5) complexity -int generator(int m) { +int calc_generator(int m) { if (m == 2) return 1; vector factors; @@ -57,7 +57,7 @@ int generator(int m) { // usage example int main() { for (int i = 0; i < 15; ++i) { - cout << "generator(" << i << ") = " << generator(i) << endl; + cout << "generator(" << i << ") = " << calc_generator(i) << endl; } - cout << "generator(" << 998244353 << ") = " << generator(998244353) << endl; + cout << "generator(" << 998244353 << ") = " << calc_generator(998244353) << endl; }