[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 3/6] qapi: Add qobject_is_equal()
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 3/6] qapi: Add qobject_is_equal() |
Date: |
Mon, 18 Sep 2017 09:15:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/16/2017 01:51 PM, Max Reitz wrote:
> This generic function (along with its implementations for different
> types) determines whether two QObjects are equal.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> + case QNUM_DOUBLE:
> + switch (num_y->kind) {
> + case QNUM_I64:
> + case QNUM_U64:
> + return false;
> + case QNUM_DOUBLE:
> + /* Comparison in native double type */
> + return num_x->u.dbl == num_y->u.dbl;
I saw comments mentioning the odd behavior of NaN; one other odd
behavior is that this treats -0.0 as equal to 0.0. But that's fine by
me (it matches C semantics of double == double).
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v5 0/6] block: Don't compare strings in bdrv_reopen_prepare(), Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 2/6] qapi/qlist: Add qlist_append_null() macro, Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 1/6] qapi/qnull: Add own header, Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 3/6] qapi: Add qobject_is_equal(), Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 4/6] block: qobject_is_equal() in bdrv_reopen_prepare(), Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 5/6] iotests: Add test for non-string option reopening, Max Reitz, 2017/09/16
- [Qemu-devel] [PATCH v5 6/6] tests: Add check-qobject for equality tests, Max Reitz, 2017/09/16