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

Function CVT_get_quad

src/common/cvt.cpp:3345–3441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3343};
3344
3345SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, DecimalStatus decSt, ErrorFunction err)
3346{
3347/**************************************
3348 *
3349 * C V T _ g e t _ q u a d
3350 *
3351 **************************************
3352 *
3353 * Functional description
3354 * Convert something arbitrary to a quad (64 bit) integer of given
3355 * scale.
3356 *
3357 **************************************/
3358 SQUAD value;
3359 VaryStr<50> buffer; // long enough to represent largest quad in ASCII
3360
3361 // adjust exact numeric values to same scaling
3362
3363 if (DTYPE_IS_EXACT(desc->dsc_dtype))
3364 scale -= desc->dsc_scale;
3365
3366 const char* p = reinterpret_cast<char*>(desc->dsc_address);
3367
3368 switch (desc->dsc_dtype)
3369 {
3370 case dtype_short:
3371 {
3372 const SSHORT input = *(SSHORT*) p;
3373 ((SLONG*) &value)[LOW_WORD] = input;
3374 ((SLONG*) &value)[HIGH_WORD] = (input < 0) ? -1 : 0;
3375 }
3376 break;
3377
3378 case dtype_long:
3379 {
3380 const SLONG input = *(SLONG*) p;
3381 ((SLONG*) &value)[LOW_WORD] = input;
3382 ((SLONG*) &value)[HIGH_WORD] = (input < 0) ? -1 : 0;
3383 }
3384 break;
3385
3386 case dtype_quad:
3387 value = *((SQUAD*) p);
3388 break;
3389
3390 case dtype_int64:
3391 SINT64_to_SQUAD(*(SINT64*) p, value);
3392 break;
3393
3394 case dtype_varying:
3395 case dtype_cstring:
3396 case dtype_text:
3397 {
3398 USHORT length =
3399 CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), decSt, err);
3400
3401 SINT64 i64;
3402 {

Callers 3

MOV_get_quadFunction · 0.85
CVT2_compareFunction · 0.85
CVT_move_commonFunction · 0.85

Calls 7

DTYPE_IS_EXACTFunction · 0.85
SINT64_to_SQUADFunction · 0.85
CVT_make_stringFunction · 0.85
cvt_decomposeFunction · 0.85
CVT_conversion_errorFunction · 0.85
CVT_get_int64Function · 0.85
GdsClass · 0.85

Tested by

no test coverage detected