Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump compiler versions #193

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -49,7 +49,7 @@ jobs:
run: |
cd cpp
mkdir bits
echo $'#include <vector>\n#include <set>\n#include <map>\n#include <unordered_set>\n#include <unordered_map>\n#include <queue>\n#include <deque>\n#include <stack>\n#include <iostream>\n#include <iomanip>\n#include <complex>\n#include <cassert>\n#include <random>\n#include <chrono>\n#include <functional>\n#include <array>\n#include <bitset>\n#include <numeric>\n' > bits/stdc++.h
echo $'#include <algorithm>\n#include <iterator>\n#include <vector>\n#include <set>\n#include <map>\n#include <unordered_set>\n#include <unordered_map>\n#include <queue>\n#include <deque>\n#include <stack>\n#include <iostream>\n#include <iomanip>\n#include <complex>\n#include <cassert>\n#include <random>\n#include <chrono>\n#include <functional>\n#include <array>\n#include <bitset>\n#include <numeric>\n' > bits/stdc++.h
find . -name '*.cpp' -print0 | xargs -n1 -0 clang++ ${{ matrix.config.compiler-options }} .

build-windows-visual-cpp-17:
Expand Down
4 changes: 2 additions & 2 deletions cpp/numbertheory/discrete_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> factors;
Expand Down Expand Up @@ -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<pair<int, int>> dec(sq);
for (int i = 1; i <= sq; ++i)
Expand Down
6 changes: 3 additions & 3 deletions cpp/numbertheory/primitive_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> factors;
Expand Down Expand Up @@ -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;
}
Loading