Skip to content

Commit

Permalink
fix wrong size from sint fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tafia committed Feb 14, 2017
1 parent 6642eeb commit 982112b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions codegen/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ impl FieldType {

fn get_size(&self, s: &str) -> String {
match *self {
FieldType::Int32 | FieldType::Sint32 | FieldType::Int64 |
FieldType::Sint64 | FieldType::Uint32 | FieldType::Uint64 |
FieldType::Int32 | FieldType::Int64 | FieldType::Uint32 | FieldType::Uint64 |
FieldType::Bool | FieldType::Enum(_) => format!("sizeof_varint(*({}) as u64)", s),
FieldType::Sint32 => format!("sizeof_sint32(*({}))", s),
FieldType::Sint64 => format!("sizeof_sint64(*({}))", s),

FieldType::Fixed64 | FieldType::Sfixed64 | FieldType::Double => "8".to_string(),
FieldType::Fixed32 | FieldType::Sfixed32 | FieldType::Float => "4".to_string(),
Expand Down

0 comments on commit 982112b

Please sign in to comment.