You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2021/02/17 11:00:21 UTC

[mynewt-mcumgr] branch master updated: Fix encoding usage for halffloat

This is an automated email from the ASF dual-hosted git repository.

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
     new b92aa0b  Fix encoding usage for halffloat
b92aa0b is described below

commit b92aa0b8c999afa285b83012cd5dd76e33a2c03a
Author: Fabio Utzig <fa...@nordicsemi.no>
AuthorDate: Wed Feb 17 07:50:46 2021 -0300

    Fix encoding usage for halffloat
    
    `cbor_encode_half_float` was being called passing in the halffloat
    (uint16_t) by value, but `cbor_encode_floating_point` accepts a `void *`
    pointer. This is already done automatically for float and double
    encoding, but must be done manually for halffloat.
    
    Signed-off-by: Fabio Utzig <fa...@nordicsemi.no>
---
 cborattr/src/cborattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cborattr/src/cborattr.c b/cborattr/src/cborattr.c
index b6aaadc..e5177d6 100644
--- a/cborattr/src/cborattr.c
+++ b/cborattr/src/cborattr.c
@@ -510,7 +510,7 @@ cbor_write_val(struct CborEncoder *enc, const struct cbor_out_val_t *val)
 
 #if FLOAT_SUPPORT
     case CborAttrHalfFloatType:
-        rc = cbor_encode_half_float(enc, val->halffloat);
+        rc = cbor_encode_half_float(enc, &val->halffloat);
         break;
 
     case CborAttrFloatType: