MCPcopy Create free account
hub / github.com/anjo76/angelscript / WriteDouble

Method WriteDouble

sdk/add_on/scriptfile/scriptfile.cpp:649–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649int CScriptFile::WriteDouble(double d)
650{
651 if( file == 0 )
652 return 0;
653
654 unsigned char buf[8];
655 union conv
656 {
657 asQWORD val;
658 double fp;
659 } value;
660 value.fp = d;
661 if( mostSignificantByteFirst )
662 {
663 for( unsigned int n = 0; n < 8; n++ )
664 buf[n] = (value.val >> ((7-n)*8)) & 0xFF;
665 }
666 else
667 {
668 for( unsigned int n = 0; n < 8; n++ )
669 buf[n] = (value.val >> (n*8)) & 0xFF;
670 }
671
672 size_t r = fwrite(&buf, 8, 1, file);
673 return int(r);
674}
675#endif
676
677

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected