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

Method WriteInt

sdk/add_on/scriptfile/scriptfile.cpp:580–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580int CScriptFile::WriteInt(asINT64 val, asUINT bytes)
581{
582 if( file == 0 )
583 return 0;
584
585 unsigned char buf[8];
586 if( mostSignificantByteFirst )
587 {
588 for( unsigned int n = 0; n < bytes; n++ )
589 buf[n] = (val >> ((bytes-n-1)*8)) & 0xFF;
590 }
591 else
592 {
593 for( unsigned int n = 0; n < bytes; n++ )
594 buf[n] = (val >> (n*8)) & 0xFF;
595 }
596
597 size_t r = fwrite(&buf, bytes, 1, file);
598 return int(r);
599}
600
601int CScriptFile::WriteUInt(asQWORD val, asUINT bytes)
602{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected