From 7d7c3cc7110427a66ee49611a357aca1e9eada0c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 2 Dec 2020 13:42:53 -0800 Subject: [PATCH] Update by review --- .../client_channel/lb_policy/grpclb/grpclb.cc | 11 ++++++----- src/core/lib/iomgr/ev_epollex_linux.cc | 3 +-- src/core/lib/iomgr/lockfree_event.cc | 5 ++--- src/core/lib/iomgr/python_util.h | 2 +- src/core/lib/iomgr/sockaddr_utils.cc | 6 ++---- src/core/lib/iomgr/sockaddr_utils.h | 2 +- src/core/lib/iomgr/tcp_custom.cc | 4 ++-- src/core/lib/iomgr/udp_server.cc | 3 +-- src/core/lib/iomgr/udp_server.h | 3 +-- src/core/lib/iomgr/unix_sockets_posix.cc | 9 +++------ .../tls/tls_security_connector.cc | 4 +--- src/core/lib/surface/call.cc | 16 ++++++++-------- src/core/lib/surface/completion_queue.cc | 6 +++--- .../tsi/alts/frame_protector/frame_handler.cc | 6 +++--- .../alts_iovec_record_protocol.cc | 6 +++--- .../alts_zero_copy_grpc_protector.cc | 6 +++--- test/core/end2end/cq_verifier.cc | 2 +- test/core/end2end/tests/cancel_with_status.cc | 3 +-- .../parse_address_with_named_scope_id_test.cc | 8 ++++---- test/core/iomgr/resolve_address_posix_test.cc | 8 ++++---- test/core/util/passthru_endpoint.cc | 3 +-- test/cpp/interop/interop_server.cc | 3 +-- tools/codegen/core/gen_static_metadata.py | 2 +- 23 files changed, 54 insertions(+), 67 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index d11cf9bcff9..edb098bc865 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -533,17 +533,18 @@ bool IsServerValid(const GrpcLbServer& server, size_t idx, bool log) { if (GPR_UNLIKELY(server.port >> 16 != 0)) { if (log) { gpr_log(GPR_ERROR, - "Invalid port '%d' at index %lu of serverlist. Ignoring.", - server.port, static_cast(idx)); + "Invalid port '%d' at index %" PRIuPTR + " of serverlist. Ignoring.", + server.port, idx); } return false; } if (GPR_UNLIKELY(server.ip_size != 4 && server.ip_size != 16)) { if (log) { gpr_log(GPR_ERROR, - "Expected IP to be 4 or 16 bytes, got %d at index %lu of " - "serverlist. Ignoring", - server.ip_size, static_cast(idx)); + "Expected IP to be 4 or 16 bytes, got %d at index %" PRIuPTR + " of serverlist. Ignoring", + server.ip_size, idx); } return false; } diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index 223a11fd1ce..1632cc82bfd 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -732,8 +732,7 @@ static grpc_error* pollset_kick(grpc_pollset* pollset, if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_INFO, "PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p", - static_cast(pollset), specific_worker, - gpr_tls_get(&g_current_thread_pollset), + pollset, specific_worker, gpr_tls_get(&g_current_thread_pollset), gpr_tls_get(&g_current_thread_worker), pollset->root_worker); } if (specific_worker == nullptr) { diff --git a/src/core/lib/iomgr/lockfree_event.cc b/src/core/lib/iomgr/lockfree_event.cc index 2828496cba8..2b89fd536fa 100644 --- a/src/core/lib/iomgr/lockfree_event.cc +++ b/src/core/lib/iomgr/lockfree_event.cc @@ -97,7 +97,7 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) { gpr_atm curr = gpr_atm_acq_load(&state_); if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this, - reinterpret_cast(curr), closure); + curr, closure); } switch (curr) { case kClosureNotReady: { @@ -165,8 +165,7 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_error) { gpr_atm curr = gpr_atm_no_barrier_load(&state_); if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s", - &state_, reinterpret_cast(curr), - grpc_error_string(shutdown_error)); + &state_, curr, grpc_error_string(shutdown_error)); } switch (curr) { case kClosureReady: diff --git a/src/core/lib/iomgr/python_util.h b/src/core/lib/iomgr/python_util.h index 77f4d12f02e..05d72a58ad0 100644 --- a/src/core/lib/iomgr/python_util.h +++ b/src/core/lib/iomgr/python_util.h @@ -36,7 +36,7 @@ inline grpc_error* grpc_socket_error(char* error) { } inline char* grpc_slice_buffer_start(grpc_slice_buffer* buffer, int i) { - return reinterpret_cast GRPC_SLICE_START_PTR(buffer->slices[i]); + return reinterpret_cast(GRPC_SLICE_START_PTR(buffer->slices[i])); } inline int grpc_slice_buffer_length(grpc_slice_buffer* buffer, int i) { diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc index bffcaefae72..6d90c13ac17 100644 --- a/src/core/lib/iomgr/sockaddr_utils.cc +++ b/src/core/lib/iomgr/sockaddr_utils.cc @@ -275,10 +275,8 @@ int grpc_sockaddr_get_port(const grpc_resolved_address* resolved_addr) { } } -int grpc_sockaddr_set_port(const grpc_resolved_address* resolved_addr, - int port) { - grpc_sockaddr* addr = const_cast( - reinterpret_cast(resolved_addr->addr)); +int grpc_sockaddr_set_port(grpc_resolved_address* resolved_addr, int port) { + grpc_sockaddr* addr = reinterpret_cast(resolved_addr->addr); switch (addr->sa_family) { case GRPC_AF_INET: GPR_ASSERT(port >= 0 && port < 65536); diff --git a/src/core/lib/iomgr/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h index 051c275d2c8..ba91e56d008 100644 --- a/src/core/lib/iomgr/sockaddr_utils.h +++ b/src/core/lib/iomgr/sockaddr_utils.h @@ -56,7 +56,7 @@ void grpc_sockaddr_make_wildcard6(int port, grpc_resolved_address* wild_out); int grpc_sockaddr_get_port(const grpc_resolved_address* addr); /* Set IP port number of a sockaddr */ -int grpc_sockaddr_set_port(const grpc_resolved_address* addr, int port); +int grpc_sockaddr_set_port(grpc_resolved_address* addr, int port); // Converts a sockaddr into a newly-allocated human-readable string. // diff --git a/src/core/lib/iomgr/tcp_custom.cc b/src/core/lib/iomgr/tcp_custom.cc index ba92ce65696..0f45c75c0d5 100644 --- a/src/core/lib/iomgr/tcp_custom.cc +++ b/src/core/lib/iomgr/tcp_custom.cc @@ -181,8 +181,8 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error* error) { /* Before calling read, we allocate a buffer with exactly one slice * to tcp->read_slices and wait for the callback indicating that the * allocation was successful. So slices[0] should always exist here */ - char* buffer = reinterpret_cast GRPC_SLICE_START_PTR( - tcp->read_slices->slices[0]); + char* buffer = reinterpret_cast( + GRPC_SLICE_START_PTR(tcp->read_slices->slices[0])); size_t len = GRPC_SLICE_LENGTH(tcp->read_slices->slices[0]); grpc_custom_socket_vtable->read(tcp->socket, buffer, len, custom_read_callback); diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc index 6490c8df09d..c2eacc5053d 100644 --- a/src/core/lib/iomgr/udp_server.cc +++ b/src/core/lib/iomgr/udp_server.cc @@ -570,8 +570,7 @@ static int add_socket_to_server(grpc_udp_server* s, int fd, return port; } -int grpc_udp_server_add_port(grpc_udp_server* s, - const grpc_resolved_address* addr, +int grpc_udp_server_add_port(grpc_udp_server* s, grpc_resolved_address* addr, int rcv_buf_size, int snd_buf_size, GrpcUdpHandlerFactory* handler_factory, size_t num_listeners) { diff --git a/src/core/lib/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h index 6cda332a5bb..ba7acbbe59f 100644 --- a/src/core/lib/iomgr/udp_server.h +++ b/src/core/lib/iomgr/udp_server.h @@ -93,8 +93,7 @@ int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index); /* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle all of the multiple socket port matching logic in one place */ -int grpc_udp_server_add_port(grpc_udp_server* s, - const grpc_resolved_address* addr, +int grpc_udp_server_add_port(grpc_udp_server* s, grpc_resolved_address* addr, int rcv_buf_size, int snd_buf_size, GrpcUdpHandlerFactory* handler_factory, size_t num_listeners); diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc index c78f56754f1..4083648dcf6 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.cc +++ b/src/core/lib/iomgr/unix_sockets_posix.cc @@ -96,10 +96,8 @@ std::string grpc_sockaddr_to_uri_unix_if_possible( if (addr->sa_family != AF_UNIX) { return ""; } - if ((reinterpret_cast(addr))->sun_path[0] == - '\0' && - (reinterpret_cast(addr))->sun_path[1] != - '\0') { + const auto* unix_addr = reinterpret_cast(addr); + if (unix_addr->sun_path[0] == '\0' && unix_addr->sun_path[1] != '\0') { const struct sockaddr_un* un = reinterpret_cast(resolved_addr->addr); return absl::StrCat( @@ -107,8 +105,7 @@ std::string grpc_sockaddr_to_uri_unix_if_possible( absl::string_view(un->sun_path + 1, resolved_addr->len - sizeof(un->sun_family) - 1)); } - return absl::StrCat( - "unix:", (reinterpret_cast(addr))->sun_path); + return absl::StrCat("unix:", unix_addr->sun_path); } #endif diff --git a/src/core/lib/security/security_connector/tls/tls_security_connector.cc b/src/core/lib/security/security_connector/tls/tls_security_connector.cc index b288cc6ead9..0bb961786f6 100644 --- a/src/core/lib/security/security_connector/tls/tls_security_connector.cc +++ b/src/core/lib/security/security_connector/tls/tls_security_connector.cc @@ -421,9 +421,7 @@ void TlsChannelSecurityConnector::ServerAuthorizationCheckArgDestroy( } gpr_free(const_cast(arg->target_name)); gpr_free(const_cast(arg->peer_cert)); - if (arg->peer_cert_full_chain) { - gpr_free(const_cast(arg->peer_cert_full_chain)); - } + gpr_free(const_cast(arg->peer_cert_full_chain)); delete arg->error_details; if (arg->destroy_context != nullptr) { arg->destroy_context(arg->context); diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 5772ae4c7a4..de97b27891c 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -834,7 +834,7 @@ static void set_encodings_accepted_by_peer(grpc_call* /*call*/, grpc_mdelem_get_user_data(mdel, destroy_encodings_accepted_by_peer); if (accepted_user_data != nullptr) { *encodings_accepted_by_peer = static_cast( - (reinterpret_cast(accepted_user_data)) - 1); + reinterpret_cast(accepted_user_data) - 1); return; } @@ -875,7 +875,7 @@ static void set_encodings_accepted_by_peer(grpc_call* /*call*/, grpc_mdelem_set_user_data( mdel, destroy_encodings_accepted_by_peer, reinterpret_cast( - (static_cast(*encodings_accepted_by_peer)) + 1)); + static_cast(*encodings_accepted_by_peer) + 1)); } uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call* call) { @@ -889,9 +889,8 @@ grpc_call_test_only_get_incoming_stream_encodings(grpc_call* call) { return call->incoming_stream_compression_algorithm; } -static grpc_linked_mdelem* linked_from_md(const grpc_metadata* md) { - return reinterpret_cast( - &const_cast(md)->internal_data); +static const grpc_linked_mdelem* linked_from_md(const grpc_metadata* md) { + return reinterpret_cast(&md->internal_data); } static grpc_metadata* get_md_elem(grpc_metadata* metadata, @@ -916,7 +915,7 @@ static int prepare_application_metadata(grpc_call* call, int count, for (i = 0; i < total_count; i++) { const grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count); - grpc_linked_mdelem* l = linked_from_md(md); + grpc_linked_mdelem* l = const_cast(linked_from_md(md)); GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data)); if (!GRPC_LOG_IF_ERROR("validate_metadata", grpc_validate_header_key_is_legal(md->key))) { @@ -936,7 +935,8 @@ static int prepare_application_metadata(grpc_call* call, int count, for (int j = 0; j < i; j++) { const grpc_metadata* md = get_md_elem(metadata, additional_metadata, j, count); - grpc_linked_mdelem* l = linked_from_md(md); + grpc_linked_mdelem* l = + const_cast(linked_from_md(md)); GRPC_MDELEM_UNREF(l->md); } return 0; @@ -954,7 +954,7 @@ static int prepare_application_metadata(grpc_call* call, int count, } for (i = 0; i < total_count; i++) { grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count); - grpc_linked_mdelem* l = linked_from_md(md); + grpc_linked_mdelem* l = const_cast(linked_from_md(md)); grpc_error* error = grpc_metadata_batch_link_tail(batch, l); if (error != GRPC_ERROR_NONE) { GRPC_MDELEM_UNREF(l->md); diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 0133fcffa8c..c262cc95978 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -796,8 +796,8 @@ static void cq_end_op_for_pluck( storage->tag = tag; storage->done = done; storage->done_arg = done_arg; - storage->next = (reinterpret_cast(&cqd->completed_head)) | - (static_cast(is_success)); + storage->next = reinterpret_cast(&cqd->completed_head) | + static_cast(is_success); gpr_mu_lock(cq->mu); cq_check_tag(cq, tag, false); /* Used in debug builds only */ @@ -805,7 +805,7 @@ static void cq_end_op_for_pluck( /* Add to the list of completions */ cqd->things_queued_ever.FetchAdd(1, grpc_core::MemoryOrder::RELAXED); cqd->completed_tail->next = - (reinterpret_cast(storage)) | (1u & cqd->completed_tail->next); + reinterpret_cast(storage) | (1u & cqd->completed_tail->next); cqd->completed_tail = storage; if (cqd->pending_events.FetchSub(1, grpc_core::MemoryOrder::ACQ_REL) == 1) { diff --git a/src/core/tsi/alts/frame_protector/frame_handler.cc b/src/core/tsi/alts/frame_protector/frame_handler.cc index 16a5d9ecfd5..905d0f22649 100644 --- a/src/core/tsi/alts/frame_protector/frame_handler.cc +++ b/src/core/tsi/alts/frame_protector/frame_handler.cc @@ -31,9 +31,9 @@ /* Use little endian to interpret a string of bytes as uint32_t. */ static uint32_t load_32_le(const unsigned char* buffer) { - return ((static_cast(buffer[3])) << 24) | - ((static_cast(buffer[2])) << 16) | - ((static_cast(buffer[1])) << 8) | + return (static_cast(buffer[3]) << 24) | + (static_cast(buffer[2]) << 16) | + (static_cast(buffer[1]) << 8) | (static_cast(buffer[0])); } diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc index 83e491db46c..870687a2a4a 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc @@ -56,9 +56,9 @@ static void maybe_append_error_msg(const char* appendix, char** dst) { /* Use little endian to interpret a string of bytes as uint32_t. */ static uint32_t load_32_le(const unsigned char* buffer) { - return ((static_cast(buffer[3])) << 24) | - ((static_cast(buffer[2])) << 16) | - ((static_cast(buffer[1])) << 8) | + return (static_cast(buffer[3]) << 24) | + (static_cast(buffer[2]) << 16) | + (static_cast(buffer[1]) << 8) | (static_cast(buffer[0])); } diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc index 1cbf839969c..ad49ed15800 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc @@ -87,9 +87,9 @@ static bool read_frame_size(const grpc_slice_buffer* sb, } GPR_ASSERT(remaining == 0); /* Gets little-endian frame size. */ - uint32_t frame_size = ((static_cast(frame_size_buffer[3])) << 24) | - ((static_cast(frame_size_buffer[2])) << 16) | - ((static_cast(frame_size_buffer[1])) << 8) | + uint32_t frame_size = (static_cast(frame_size_buffer[3]) << 24) | + (static_cast(frame_size_buffer[2]) << 16) | + (static_cast(frame_size_buffer[1]) << 8) | (static_cast(frame_size_buffer[0])); if (frame_size > kMaxFrameLength) { gpr_log(GPR_ERROR, "Frame size is larger than maximum frame size"); diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index 8667781f85c..da526ea9927 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -187,7 +187,7 @@ int byte_buffer_eq_string(grpc_byte_buffer* bb, const char* str) { } static bool is_probably_integer(void* p) { - return (reinterpret_cast(p)) < 1000000; + return reinterpret_cast(p) < 1000000; } namespace { diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc index 7b32ef36fcb..80eb5e00d29 100644 --- a/test/core/end2end/tests/cancel_with_status.cc +++ b/test/core/end2end/tests/cancel_with_status.cc @@ -140,8 +140,7 @@ static void simple_request_body(grpc_end2end_test_config /*config*/, GPR_ASSERT(GRPC_CALL_OK == error); char* dynamic_string = gpr_strdup("xyz"); - grpc_call_cancel_with_status(c, GRPC_STATUS_UNIMPLEMENTED, - reinterpret_cast(dynamic_string), + grpc_call_cancel_with_status(c, GRPC_STATUS_UNIMPLEMENTED, dynamic_string, nullptr); // The API of \a description allows for it to be a dynamic/non-const // string, test this guarantee. diff --git a/test/core/iomgr/parse_address_with_named_scope_id_test.cc b/test/core/iomgr/parse_address_with_named_scope_id_test.cc index 8691033a657..1fcc60b1e98 100644 --- a/test/core/iomgr/parse_address_with_named_scope_id_test.cc +++ b/test/core/iomgr/parse_address_with_named_scope_id_test.cc @@ -101,10 +101,10 @@ int main(int argc, char** argv) { // system recognizes, and then use that for the test. for (size_t i = 1; i < 65536; i++) { if (if_indextoname(i, arbitrary_interface_name) != nullptr) { - gpr_log( - GPR_DEBUG, - "Found interface at index %d named %s. Will use this for the test", - static_cast(i), arbitrary_interface_name); + gpr_log(GPR_DEBUG, + "Found interface at index %" PRIuPTR + " named %s. Will use this for the test", + i, arbitrary_interface_name); break; } } diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index 1a60e58c389..c8bebc73372 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -158,10 +158,10 @@ static void test_named_and_numeric_scope_ids(void) { // system recognizes, and then use that for the test. for (size_t i = 1; i < 65536; i++) { if (if_indextoname(i, arbitrary_interface_name) != nullptr) { - gpr_log( - GPR_DEBUG, - "Found interface at index %d named %s. Will use this for the test", - static_cast(i), arbitrary_interface_name); + gpr_log(GPR_DEBUG, + "Found interface at index %" PRIuPTR + " named %s. Will use this for the test", + i, arbitrary_interface_name); interface_index = static_cast(i); break; } diff --git a/test/core/util/passthru_endpoint.cc b/test/core/util/passthru_endpoint.cc index 4b08d796ca6..f856481bc65 100644 --- a/test/core/util/passthru_endpoint.cc +++ b/test/core/util/passthru_endpoint.cc @@ -198,8 +198,7 @@ static void half_init(half* m, passthru_endpoint* parent, grpc_slice_buffer_init(&m->read_buffer); m->on_read = nullptr; std::string name = - absl::StrFormat("passthru_endpoint_%s_%" PRIxPTR, half_name, - reinterpret_cast(parent)); + absl::StrFormat("passthru_endpoint_%s_%p", half_name, parent); m->resource_user = grpc_resource_user_create(resource_quota, name.c_str()); } diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index b313d2ec5b2..51f66d482a2 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -149,8 +149,7 @@ class TestServiceImpl : public TestService::Service { const SimpleRequest* /*request*/, SimpleResponse* response) override { gpr_timespec ts = gpr_now(GPR_CLOCK_PRECISE); - std::string timestamp = - std::to_string(static_cast(ts.tv_nsec)); + std::string timestamp = std::to_string(ts.tv_nsec); response->mutable_payload()->set_body(timestamp.c_str(), timestamp.size()); context->AddInitialMetadata("cache-control", "max-age=60, public"); return Status::OK; diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 4d3a38cf249..08cc139033e 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -637,7 +637,7 @@ static uint32_t %(name)s_phash(uint32_t i) { uint32_t y = i / %(t)d; uint32_t h = x; if (y < GPR_ARRAY_SIZE(%(name)s_r)) { - uint32_t delta = (uint32_t)%(name)s_r[y]; + uint32_t delta = static_cast(%(name)s_r[y]); h += delta; } return h;