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