|
|
@ -41,25 +41,14 @@ |
|
|
|
const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027}; |
|
|
|
const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027}; |
|
|
|
|
|
|
|
|
|
|
|
bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { |
|
|
|
bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { |
|
|
|
static const uint32_t r[] = { |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0}; |
|
|
|
|
|
|
|
uint32_t i = wire_id - 1; |
|
|
|
uint32_t i = wire_id - 1; |
|
|
|
uint32_t x = i % 256; |
|
|
|
uint32_t x = i % 256; |
|
|
|
uint32_t y = i / 256; |
|
|
|
uint32_t y = i / 256; |
|
|
|
uint32_t h = x; |
|
|
|
uint32_t h = x; |
|
|
|
if (y < GPR_ARRAY_SIZE(r)) { |
|
|
|
switch (y) { |
|
|
|
uint32_t delta = (uint32_t)r[y]; |
|
|
|
case 254: |
|
|
|
h += delta; |
|
|
|
h += 4; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
*out = (grpc_chttp2_setting_id)h; |
|
|
|
*out = (grpc_chttp2_setting_id)h; |
|
|
|
return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && |
|
|
|
return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && |
|
|
|