diff options
author | David Garcia Quintas <dgq@google.com> | 2015-10-05 13:40:07 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-10-05 13:40:07 -0700 |
commit | 809831eef7263c2c6ed189b28c5df617cbb8a543 (patch) | |
tree | 93210bbb860c7a7570c46be36db2614396c0d96c /src/core | |
parent | d76cdac17a394d5a4be882ef0474db605db0c950 (diff) |
Added comments
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/surface/call.c | 16 | ||||
-rw-r--r-- | src/core/transport/chttp2/bin_encoder.c | 10 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 3f06507f9f..e31b89489f 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -424,6 +424,11 @@ static grpc_cq_completion *allocate_completion(grpc_call *call) { if (call->allocated_completions & (1u << i)) { continue; } + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard), which in this case upcasts the result + * of the bitwise OR to "unsigned". A cast to the smaller container type is + * then required to avoid the compiler warning */ call->allocated_completions = (gpr_uint8)(call->allocated_completions | (1u << i)); gpr_mu_unlock(&call->completion_mu); @@ -736,6 +741,11 @@ static void finish_live_ioreq_op(grpc_call *call, grpc_ioreq_op op, size_t i; /* ioreq is live: we need to do something */ master = &call->masters[master_set]; + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard), which in this case upcasts the result + * of the bitwise OR to "unsigned". A cast to the smaller container type is + * then required to avoid the compiler warning */ master->complete_mask = (gpr_uint16)(master->complete_mask | (1u << op)); if (!success) { master->success = 0; @@ -1246,6 +1256,11 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs, GRPC_MDSTR_REF(reqs[i].data.send_status.details)); } } + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard), which in this case upcasts the result + * of the bitwise OR to "unsigned". A cast to the smaller container type is + * then required to avoid the compiler warning */ have_ops = (gpr_uint16)(have_ops | (1u << op)); call->request_data[op] = data; @@ -1831,4 +1846,3 @@ void *grpc_call_context_get(grpc_call *call, grpc_context_index elem) { } gpr_uint8 grpc_call_is_client(grpc_call *call) { return call->is_client; } - diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/transport/chttp2/bin_encoder.c index b0b04f697a..5266f3ebf7 100644 --- a/src/core/transport/chttp2/bin_encoder.c +++ b/src/core/transport/chttp2/bin_encoder.c @@ -185,6 +185,11 @@ gpr_slice grpc_chttp2_huffman_compress(gpr_slice input) { } if (temp_length) { + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard), which in this case upcasts the result + * of the bitwise OR to "unsigned". A cast to the smaller container type is + * then required to avoid the compiler warning */ *out++ = (gpr_uint8)((gpr_uint8)(temp << (8u - temp_length)) | (gpr_uint8)(0xffu >> temp_length)); } @@ -265,6 +270,11 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input) { } if (out.temp_length) { + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard), which in this case upcasts the result + * of the bitwise OR to "unsigned". A cast to the smaller container type is + * then required to avoid the compiler warning */ *out.out++ = (gpr_uint8)((gpr_uint8)(out.temp << (8u - out.temp_length)) | (gpr_uint8)(0xffu >> out.temp_length)); } |