[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Portable Code (am I dreaming? :))
From:       Nicolas Goutte <nicog () snafu ! de>
Date:       2002-01-26 20:52:34
[Download RAW message or body]

On Saturday 26 January 2002 11:51, Clarence Dang wrote:
> On Sat, 26 Jan 2002 10:13, shaheed wrote:
> > Clarence,
> >
> > Nicolas is right that the performance is not an issue. Getting it right
> > is much more important. I bet the time spent in the mword read()
> > functions is less than 1% of the time taken to load a Word document.
> > Consider for example how many instructions it takes to render a single
> > letter.
>
> Before comitting to CVS, my code read in one byte at a time.
> The version I have in CVS, reads a thousand bytes at a time and was found
> to be 2x faster. So this is what I plan to do:
>
> #if defined (I_HAVE_A_32_BIT_X86_SYSTEM)
> 	// do fast, i386, unportable read functions
> #else
> 	// do slower, portable, one-byte-at-a-time functions
> #endif
>
> That way I can have the best of both worlds! :)
> Is this a good or a bad idea (all my ideas seem to have flaws in them :)).
> Only problem is: does anyone know where I can find such a #define in
> config.h or similar?

If you do not mind to have a define NEED_PORTABLE_FILTER, then may be this 
code (not tested):

// start
#include <config.h>
#ifdef WORDS_BIGENDIAN
#define NEED_PORTABLE_FILTER
#else
# if SIZEOF_LONG != 4
# define NEED_PORTABLE_FILTER
# endif
#endif
// end

And if you need to debug the portable version, you just add:

#define NEED_PORTABLE_FILTER



(...)

>
>
> Thanks!
> Clarence
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic