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

Method ReadUInt

sdk/add_on/scriptfile/scriptfile.cpp:471–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471asQWORD CScriptFile::ReadUInt(asUINT bytes)
472{
473 if( file == 0 )
474 return 0;
475
476 if( bytes > 8 ) bytes = 8;
477 if( bytes == 0 ) return 0;
478
479 unsigned char buf[8];
480 size_t r = fread(buf, bytes, 1, file);
481 if( r == 0 ) return 0;
482
483 asQWORD val = 0;
484 if( mostSignificantByteFirst )
485 {
486 unsigned int n = 0;
487 for( ; n < bytes; n++ )
488 val |= asQWORD(buf[n]) << ((bytes-n-1)*8);
489 }
490 else
491 {
492 unsigned int n = 0;
493 for( ; n < bytes; n++ )
494 val |= asQWORD(buf[n]) << (n*8);
495 }
496
497 return val;
498}
499
500float CScriptFile::ReadFloat()
501{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected