Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbor_encode_half_float() get error value #155

Closed
tianxiaoMCU opened this issue Feb 26, 2019 · 1 comment
Closed

cbor_encode_half_float() get error value #155

tianxiaoMCU opened this issue Feb 26, 2019 · 1 comment

Comments

@tianxiaoMCU
Copy link

Tested in QT 5.12

    float halfdata = 23.5;
    uint8_t buf[16] = {0};
    CborEncoder encoder;
    cbor_encoder_init(&encoder, &buf, sizeof(buf), 0);
    cbor_encode_half_float(&encoder, &halfdata);

run the demo,the encode data is F9 00 00

@thiagomacieira
Copy link
Member

thiagomacieira commented Mar 4, 2019

You've passed the pointer to a (full) float to cbor_encode_half_float. You're supposed to pass a pointer to a half float data, by using qfloat16, __fp16 or cbor_encode_float_as_half_float (see PR #149 for this function) or some other function of yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants