MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / genNegZero

Method genNegZero

src/dsql/ExprNodes.cpp:7636–7663  ·  view source on GitHub ↗

Generate BLR for a negated zero (take care about possible DECFLOAT).

Source from the content-addressed store, hash-verified

7634
7635// Generate BLR for a negated zero (take care about possible DECFLOAT).
7636void LiteralNode::genNegZero(DsqlCompilerScratch* dsqlScratch, int prec)
7637{
7638 char buf[32]; // 18 bytes for max number of digits + some reserve
7639 char* s = buf;
7640 *s++ = '-';
7641 *s++ = '0';
7642
7643 if (prec)
7644 {
7645 *s++ = '.';
7646 while (prec--)
7647 *s++ = '0';
7648 }
7649 *s = 0;
7650
7651 dsc desc;
7652 desc.dsc_dtype = dtype_double;
7653 desc.dsc_scale = 0;
7654 desc.dsc_length = sizeof(double);
7655 desc.dsc_address = (UCHAR*) buf;
7656
7657 GEN_descriptor(dsqlScratch, &desc, true);
7658
7659 const USHORT len = static_cast<USHORT>(s - buf);
7660 dsqlScratch->appendUShort(len);
7661 if (len)
7662 dsqlScratch->appendBytes(desc.dsc_address, len);
7663}
7664
7665// Generate BLR for a constant.
7666void LiteralNode::genConstant(DsqlCompilerScratch* dsqlScratch, const dsc* desc, bool negateValue, USHORT numStringLength)

Callers

nothing calls this directly

Calls 3

GEN_descriptorFunction · 0.85
appendUShortMethod · 0.80
appendBytesMethod · 0.80

Tested by

no test coverage detected