Auto-generate files after cl/637127851

pull/16945/head^2
Protobuf Team Bot 10 months ago
parent f65108072b
commit 58c48fd66e
  1. 10
      php/ext/google/protobuf/php-upb.c
  2. 10
      ruby/ext/google/protobuf_c/ruby-upb.c

@ -11591,6 +11591,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
// Must be last.
@ -11610,6 +11612,10 @@ static void upb_FixLocale(char* p) {
void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
assert(size >= kUpb_RoundTripBufferSize);
if (isnan(val)) {
snprintf(buf, size, "%s", "nan");
return;
}
snprintf(buf, size, "%.*g", DBL_DIG, val);
if (strtod(buf, NULL) != val) {
snprintf(buf, size, "%.*g", DBL_DIG + 2, val);
@ -11620,6 +11626,10 @@ void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size) {
assert(size >= kUpb_RoundTripBufferSize);
if (isnan(val)) {
snprintf(buf, size, "%s", "nan");
return;
}
snprintf(buf, size, "%.*g", FLT_DIG, val);
if (strtof(buf, NULL) != val) {
snprintf(buf, size, "%.*g", FLT_DIG + 3, val);

@ -11079,6 +11079,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
// Must be last.
@ -11098,6 +11100,10 @@ static void upb_FixLocale(char* p) {
void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
assert(size >= kUpb_RoundTripBufferSize);
if (isnan(val)) {
snprintf(buf, size, "%s", "nan");
return;
}
snprintf(buf, size, "%.*g", DBL_DIG, val);
if (strtod(buf, NULL) != val) {
snprintf(buf, size, "%.*g", DBL_DIG + 2, val);
@ -11108,6 +11114,10 @@ void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size) {
assert(size >= kUpb_RoundTripBufferSize);
if (isnan(val)) {
snprintf(buf, size, "%s", "nan");
return;
}
snprintf(buf, size, "%.*g", FLT_DIG, val);
if (strtof(buf, NULL) != val) {
snprintf(buf, size, "%.*g", FLT_DIG + 3, val);

Loading…
Cancel
Save