Function Pointers

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
Posts: 1236
Joined: Thu Sep 15, 2005 9:23 am
Location: Berlin, Germany

Function Pointers

Post by WedNESday » Mon Nov 24, 2008 6:39 am

Would these be faster than a bigger lookup table? (I'm talking about 65816 emulation here, changing the pointers of functions when switching between Native and Emulation mode)

User avatar
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA

Post by blargg » Mon Nov 24, 2008 10:43 am

You haven't provided enough information. Probably better to learn how to measure performance and compare the two on your machine. This is a good start:

Code: Select all

#include <stdio.h>
#include <time.h>
int main()
    clock_t start = clock();
    unsigned n;
    for ( n = 1000000; --n; )
        /* do something here */
    printf( "time taken: %f\n", (double) (clock() - start) );
    return 0;

Post Reply