library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kk2a/library

:warning: bigint/int256.hpp

Depends on

Code

#ifndef KK2_BIGINT_INT256_HPP
#define KK2_BIGINT_INT256_HPP 1

#include <cstdint>
#include <string>

#include "../type_traits/integral.hpp"
#include "../type_traits/io.hpp"

namespace kk2 {

namespace bigint {

struct uint256 {
    using u64 = uint64_t;
    using u128 = __uint128_t;
    using u256 = uint256;

    constexpr uint256() { _v[0] = _v[1] = 0; }
    template <class T, is_integral_t<T> * = nullptr> constexpr uint256(T x) {
        _v[0] = x, _v[1] = 0;
    }

    constexpr uint256 &operator+=(const uint256 &r) {
        _v[1] += r._v[1];
        bool a = _v[0] >> 127;
        bool b = r._v[0] >> 127;
        _v[0] = ((_v[0] << 1) >> 1) + ((r._v[0] << 1) >> 1);
        bool c = _v[0] >> 127;
        if ((a and b) or (b and c) or (c and a)) ++_v[1];
        _v[0] = _v[0] ^ (u128(a) << 127) ^ (u128(b) << 127);
        return *this;
    }

  private:
    u128 _v[2];
};

} // namespace bigint

using u256 = bigint::uint256;

} // namespace kk2


#endif // KK2_BIGINT_INT256_HPP
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: type_traits/integral.hpp: line 4: #pragma once found in a non-first line
Back to top page