omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / evidence / deepinfer / cxx / floor_prefix.hdr-cpp
| 1 | #include <cstdint> |
| 2 | static std::int64_t floor_prefix(std::int64_t n, std::int64_t ratio) { |
| 3 | const std::int64_t blocks = n / ratio; |
| 4 | return blocks * (n + 1) - ratio * blocks * (blocks + 1) / 2; |
| 5 | } |