dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: file read/write code

Re: file read/write code

From: Björn Stenberg <>
Date: Fri, 8 Nov 2002 17:38:00 +0100

Greg Haerr wrote:
> Let me know what you think of this.

Correct me if I'm wrong, but it looks like you sacrify 50% transfer speed for simpler code.

Your code buffers all sectors. That's what makes it simple - read() does not need to bother about which sectors are cached and not. It just memcpies everything. The penalty is harsh, though. Your code copies every byte twice (disk->buffer, buffer->target), while the current code only copies once (disk->target, except for head and tail bytes).

Is there a simple way around this that I don't see?

> Take a look at the gcc -S output and you'll see huge differences
> with code speed and size when an unsigned divide or modulo
> is computed, versus a signed divide/modulo.

Thanks for the heads-up. Although I prefer to use unsigned int rather than long.

Received on 2002-11-08

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy