hook up Dart Int64 scalars

PiperOrigin-RevId: 500017090
pull/13171/head
Eric Salo 2 years ago committed by Copybara-Service
parent 7a1bd9faa7
commit 0e286b4037
  1. 40
      upbc/upbc_so.c

@ -40,3 +40,43 @@
// Must be last.
#include "upb/port/def.inc"
// JavaScript doesn't directly support 64-bit ints so we must split them.
UPB_API_INLINE uint32_t upb_Message_GetInt64Hi(const upb_Message* msg,
const upb_MiniTableField* field,
uint32_t default_value) {
return (uint32_t)(upb_Message_GetInt64(msg, field, default_value) >> 32);
}
UPB_API_INLINE uint32_t upb_Message_GetInt64Lo(const upb_Message* msg,
const upb_MiniTableField* field,
uint32_t default_value) {
return (uint32_t)upb_Message_GetInt64(msg, field, default_value);
}
UPB_API_INLINE bool upb_Message_SetInt64Split(upb_Message* msg,
const upb_MiniTableField* field,
uint32_t hi, uint32_t lo,
upb_Arena* a) {
return upb_Message_SetInt64(msg, field, ((int64_t)hi << 32) | lo, a);
}
UPB_API_INLINE uint32_t upb_Message_GetUInt64Hi(const upb_Message* msg,
const upb_MiniTableField* field,
uint32_t default_value) {
return (uint32_t)(upb_Message_GetUInt64(msg, field, default_value) >> 32);
}
UPB_API_INLINE uint32_t upb_Message_GetUInt64Lo(const upb_Message* msg,
const upb_MiniTableField* field,
uint32_t default_value) {
return (uint32_t)upb_Message_GetUInt64(msg, field, default_value);
}
UPB_API_INLINE bool upb_Message_SetUInt64Split(upb_Message* msg,
const upb_MiniTableField* field,
uint32_t hi, uint32_t lo,
upb_Arena* a) {
return upb_Message_SetUInt64(msg, field, ((uint64_t)hi << 32) | lo, a);
}

Loading…
Cancel
Save