From b134d862902fc7113a8c11de3ebd317745ea2584 Mon Sep 17 00:00:00 2001 From: Xargin Date: Wed, 6 Sep 2017 13:14:54 +0800 Subject: [PATCH] optimize code --- extra/fuzzy_decoder.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extra/fuzzy_decoder.go b/extra/fuzzy_decoder.go index a99e374..9b63c27 100644 --- a/extra/fuzzy_decoder.go +++ b/extra/fuzzy_decoder.go @@ -202,8 +202,7 @@ func (decoder *fuzzyIntegerDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It case jsoniter.StringValue: str = iter.ReadString() case jsoniter.BoolValue: - b := iter.ReadBool() - if b == true { + if iter.ReadBool() { str = "1" } else { str = "0" @@ -239,8 +238,7 @@ func (decoder *fuzzyFloat32Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It } case jsoniter.BoolValue: // support bool to float32 - b := iter.ReadBool() - if b == true { + if iter.ReadBool() { *((*float32)(ptr)) = 1 } else { *((*float32)(ptr)) = 0 @@ -269,8 +267,7 @@ func (decoder *fuzzyFloat64Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It } case jsoniter.BoolValue: // support bool to float64 - b := iter.ReadBool() - if b == true { + if iter.ReadBool() { *((*float64)(ptr)) = 1 } else { *((*float64)(ptr)) = 0