MCPcopy Create free account
hub / github.com/TASEmulators/fceux / FastStrToU16

Function FastStrToU16

src/utils/xstring.cpp:449–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447static char TempArray[11];
448
449uint16 FastStrToU16(char* s, bool& valid)
450{
451 int i;
452 uint16 v=0;
453 for(i=0; i < 4; i++)
454 {
455 if(s[i] == 0) return v;
456 v<<=4;
457 if(s[i] >= '0' && s[i] <= '9')
458 {
459 v+=s[i]-'0';
460 }
461 else if(s[i] >= 'a' && s[i] <= 'f')
462 {
463 v+=s[i]-'a'+10;
464 }
465 else if(s[i] >= 'A' && s[i] <= 'F')
466 {
467 v+=s[i]-'A'+10;
468 }
469 else
470 {
471 valid = false;
472 return 0xFFFF;
473 }
474 }
475 valid = true;
476 return v;
477}
478
479char *U8ToDecStr(uint8 a)
480{

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected