MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / SIValue_Add

Function SIValue_Add

src/value.c:477–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477SIValue SIValue_Add(const SIValue a, const SIValue b) {
478 if(a.type == T_NULL || b.type == T_NULL) return SI_NullVal();
479 if(a.type == T_ARRAY || b.type == T_ARRAY) return SIValue_ConcatList(a, b);
480 if(a.type == T_STRING || b.type == T_STRING) return SIValue_ConcatString(a, b);
481 /* Only construct an integer return if both operands are integers. */
482 if(a.type & b.type & T_INT64) {
483 return SI_LongVal(a.longval + b.longval);
484 }
485 /* Return a double representation. */
486 return SI_DoubleVal(SI_GET_NUMERIC(a) + SI_GET_NUMERIC(b));
487}
488
489SIValue SIValue_Subtract(const SIValue a, const SIValue b) {
490 /* Only construct an integer return if both operands are integers. */

Callers 1

AR_ADDFunction · 0.85

Calls 5

SI_NullValFunction · 0.85
SIValue_ConcatListFunction · 0.85
SIValue_ConcatStringFunction · 0.85
SI_LongValFunction · 0.85
SI_DoubleValFunction · 0.85

Tested by

no test coverage detected