• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › General Discussion v
« Previous 1 ... 359 360 361 362 363 ... 368 Next »

Code Something odd..
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Code Something odd..
07-10-2009, 04:08 AM
#1
ThuGie Offline
Member
***
Posts: 59
Threads: 5
Joined: May 2009
Hey,

When i noticed the latest update it said silly typo so i wanted to check what it was,
btw it was a silly typo..

But while browsing tru the file i noticed,

Code:
bool IsHexDigit(char c) {
    switch (c) {
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
        case 'a':
        case 'b':
        case 'c':
        case 'd':
        case 'e':
        case 'f':
            return true;
        default:
            return false;
    }
}

bool IsAlpha(char c) {
    return (c >= 'A' && c <= 'Z') ||
           (c >= 'a' && c <= 'z');
}

Notice how isAplha is being handled and isHexDigit ?
Its about the same but done diffrently is this done for a speed purpose ?
If not couldnt you just use

Code:
// lower case only
bool IsHexDigit(char c) {
    return (c >= '0' && c <= 'f');
}


bool IsAlpha(char c) {
    return (c >= 'A' && c <= 'Z') ||
           (c >= 'a' && c <= 'z');
}

I would say it looks alot cleaner :/.
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode