Skip to content

Commit 7a037d7

Browse files
authored
[k2] fix FP fetchers (#1525)
1 parent 5361421 commit 7a037d7

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

runtime-light/stdlib/rpc/rpc-api.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ kphp::coro::task<class_instance<C$VK$TL$RpcResponse>> typed_rpc_tl_query_result_
7575

7676
// === server =====================================================================================
7777

78-
inline bool f$store_int(int64_t v) noexcept {
79-
if (tl::is_int32_overflow(v)) [[unlikely]] {
80-
kphp::log::warning("integer {} overflows int32, it will be cast to {}", v, static_cast<int32_t>(v));
81-
}
82-
tl::i32{.value = static_cast<int32_t>(v)}.store(RpcServerInstanceState::get().tl_storer);
83-
return true;
84-
}
85-
8678
inline bool f$store_byte(int64_t v) noexcept {
8779
if (v < 0 || v > 255) [[unlikely]] {
8880
kphp::log::warning("integer {} overflows uint8, it will be cast to {}", v, static_cast<uint8_t>(v));
@@ -91,6 +83,14 @@ inline bool f$store_byte(int64_t v) noexcept {
9183
return true;
9284
}
9385

86+
inline bool f$store_int(int64_t v) noexcept {
87+
if (tl::is_int32_overflow(v)) [[unlikely]] {
88+
kphp::log::warning("integer {} overflows int32, it will be cast to {}", v, static_cast<int32_t>(v));
89+
}
90+
tl::i32{.value = static_cast<int32_t>(v)}.store(RpcServerInstanceState::get().tl_storer);
91+
return true;
92+
}
93+
9494
inline bool f$store_long(int64_t v) noexcept {
9595
tl::i64{.value = v}.store(RpcServerInstanceState::get().tl_storer);
9696
return true;
@@ -148,7 +148,7 @@ inline int64_t f$fetch_long() noexcept {
148148
return DEFAULT_VALUE;
149149
}
150150

151-
inline double f$fetch_double() noexcept {
151+
inline double f$fetch_float() noexcept {
152152
static constexpr double DEFAULT_VALUE = 0.0;
153153
if (tl::f32 val{}; val.fetch(RpcServerInstanceState::get().tl_fetcher)) [[likely]] {
154154
return static_cast<double>(val.value);
@@ -157,7 +157,7 @@ inline double f$fetch_double() noexcept {
157157
return DEFAULT_VALUE;
158158
}
159159

160-
inline double f$fetch_float() noexcept {
160+
inline double f$fetch_double() noexcept {
161161
static constexpr double DEFAULT_VALUE = 0.0;
162162
if (tl::f64 val{}; val.fetch(RpcServerInstanceState::get().tl_fetcher)) [[likely]] {
163163
return val.value;

0 commit comments

Comments
 (0)