ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/XS.xs
(Generate patch)

Comparing CBOR-XS/XS.xs (file contents):
Revision 1.68 by root, Mon Nov 30 18:30:29 2020 UTC vs.
Revision 1.69 by root, Mon Nov 30 20:38:25 2020 UTC

418 memcpy (enc->cur, &fp, 8); 418 memcpy (enc->cur, &fp, 8);
419 enc->cur += 8; 419 enc->cur += 8;
420} 420}
421 421
422ecb_inline void 422ecb_inline void
423encode_bool (enc_t *enc, int istrue)
424{
425 encode_ch (enc, istrue ? MAJOR_MISC | SIMPLE_TRUE : MAJOR_MISC | SIMPLE_FALSE);
426}
427
428ecb_inline void
423encode_forced (enc_t *enc, UV type, SV *sv) 429encode_forced (enc_t *enc, UV type, SV *sv)
424{ 430{
425 switch (type) 431 switch (type)
426 { 432 {
427 case AS_CBOR: 433 case AS_CBOR:
449 char *str = SvPVutf8 (sv, len); 455 char *str = SvPVutf8 (sv, len);
450 encode_strref (enc, 1, 1, str, len); 456 encode_strref (enc, 1, 1, str, len);
451 } 457 }
452 break; 458 break;
453 459
454 case AS_INT: encode_int (enc, sv); break; 460 case AS_INT: encode_int (enc, sv); break;
461
455 case AS_FLOAT16: encode_float16 (enc, SvNV (sv)); break; 462 case AS_FLOAT16: encode_float16 (enc, SvNV (sv)); break;
456 case AS_FLOAT32: encode_float32 (enc, SvNV (sv)); break; 463 case AS_FLOAT32: encode_float32 (enc, SvNV (sv)); break;
457 case AS_FLOAT64: encode_float64 (enc, SvNV (sv)); break; 464 case AS_FLOAT64: encode_float64 (enc, SvNV (sv)); break;
458 465
459 default: 466 default:
547 554
548 HV *stash = SvSTASH (sv); 555 HV *stash = SvSTASH (sv);
549 556
550 if (stash == boolean_stash) 557 if (stash == boolean_stash)
551 { 558 {
552 encode_ch (enc, SvIV (sv) ? MAJOR_MISC | SIMPLE_TRUE : MAJOR_MISC | SIMPLE_FALSE); 559 encode_bool (enc, SvIV (sv));
553 return; 560 return;
554 } 561 }
555 else if (stash == error_stash) 562 else if (stash == error_stash)
556 { 563 {
557 encode_ch (enc, MAJOR_MISC | SIMPLE_UNDEF); 564 encode_ch (enc, MAJOR_MISC | SIMPLE_UNDEF);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines