diff --git a/runtime-light/stdlib/rpc/rpc-api.h b/runtime-light/stdlib/rpc/rpc-api.h index cbeda65d23..5a9a43872b 100644 --- a/runtime-light/stdlib/rpc/rpc-api.h +++ b/runtime-light/stdlib/rpc/rpc-api.h @@ -75,14 +75,6 @@ kphp::coro::task> typed_rpc_tl_query_result_ // === server ===================================================================================== -inline bool f$store_int(int64_t v) noexcept { - if (tl::is_int32_overflow(v)) [[unlikely]] { - kphp::log::warning("integer {} overflows int32, it will be cast to {}", v, static_cast(v)); - } - tl::i32{.value = static_cast(v)}.store(RpcServerInstanceState::get().tl_storer); - return true; -} - inline bool f$store_byte(int64_t v) noexcept { if (v < 0 || v > 255) [[unlikely]] { kphp::log::warning("integer {} overflows uint8, it will be cast to {}", v, static_cast(v)); @@ -91,6 +83,14 @@ inline bool f$store_byte(int64_t v) noexcept { return true; } +inline bool f$store_int(int64_t v) noexcept { + if (tl::is_int32_overflow(v)) [[unlikely]] { + kphp::log::warning("integer {} overflows int32, it will be cast to {}", v, static_cast(v)); + } + tl::i32{.value = static_cast(v)}.store(RpcServerInstanceState::get().tl_storer); + return true; +} + inline bool f$store_long(int64_t v) noexcept { tl::i64{.value = v}.store(RpcServerInstanceState::get().tl_storer); return true; @@ -148,7 +148,7 @@ inline int64_t f$fetch_long() noexcept { return DEFAULT_VALUE; } -inline double f$fetch_double() noexcept { +inline double f$fetch_float() noexcept { static constexpr double DEFAULT_VALUE = 0.0; if (tl::f32 val{}; val.fetch(RpcServerInstanceState::get().tl_fetcher)) [[likely]] { return static_cast(val.value); @@ -157,7 +157,7 @@ inline double f$fetch_double() noexcept { return DEFAULT_VALUE; } -inline double f$fetch_float() noexcept { +inline double f$fetch_double() noexcept { static constexpr double DEFAULT_VALUE = 0.0; if (tl::f64 val{}; val.fetch(RpcServerInstanceState::get().tl_fetcher)) [[likely]] { return val.value;