qnum.c (7e0019a7196ebed177c95824875cf852e1a6f667) | qnum.c (7dc847ebba953db90853d15f140c20eef74d4fb2) |
---|---|
1/* 2 * QNum Module 3 * 4 * Copyright (C) 2009 Red Hat Inc. 5 * 6 * Authors: 7 * Luiz Capitulino <lcapitulino@redhat.com> 8 * Anthony Liguori <aliguori@us.ibm.com> --- 207 unchanged lines hidden (view full) --- 216 * Negative integers are never considered equal to unsigned integers, 217 * but positive integers in the range [0, INT64_MAX] are considered 218 * equal independently of whether the QNum's kind is i64 or u64. 219 * 220 * Doubles are never considered equal to integers. 221 */ 222bool qnum_is_equal(const QObject *x, const QObject *y) 223{ | 1/* 2 * QNum Module 3 * 4 * Copyright (C) 2009 Red Hat Inc. 5 * 6 * Authors: 7 * Luiz Capitulino <lcapitulino@redhat.com> 8 * Anthony Liguori <aliguori@us.ibm.com> --- 207 unchanged lines hidden (view full) --- 216 * Negative integers are never considered equal to unsigned integers, 217 * but positive integers in the range [0, INT64_MAX] are considered 218 * equal independently of whether the QNum's kind is i64 or u64. 219 * 220 * Doubles are never considered equal to integers. 221 */ 222bool qnum_is_equal(const QObject *x, const QObject *y) 223{ |
224 QNum *num_x = qobject_to_qnum(x); 225 QNum *num_y = qobject_to_qnum(y); | 224 QNum *num_x = qobject_to(QNum, x); 225 QNum *num_y = qobject_to(QNum, y); |
226 227 switch (num_x->kind) { 228 case QNUM_I64: 229 switch (num_y->kind) { 230 case QNUM_I64: 231 /* Comparison in native int64_t type */ 232 return num_x->u.i64 == num_y->u.i64; 233 case QNUM_U64: --- 32 unchanged lines hidden (view full) --- 266 267/** 268 * qnum_destroy_obj(): Free all memory allocated by a 269 * QNum object 270 */ 271void qnum_destroy_obj(QObject *obj) 272{ 273 assert(obj != NULL); | 226 227 switch (num_x->kind) { 228 case QNUM_I64: 229 switch (num_y->kind) { 230 case QNUM_I64: 231 /* Comparison in native int64_t type */ 232 return num_x->u.i64 == num_y->u.i64; 233 case QNUM_U64: --- 32 unchanged lines hidden (view full) --- 266 267/** 268 * qnum_destroy_obj(): Free all memory allocated by a 269 * QNum object 270 */ 271void qnum_destroy_obj(QObject *obj) 272{ 273 assert(obj != NULL); |
274 g_free(qobject_to_qnum(obj)); | 274 g_free(qobject_to(QNum, obj)); |
275} | 275} |