From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <8edba5d726ee6a032d8521c7de33f499@felloff.net> References: <8edba5d726ee6a032d8521c7de33f499@felloff.net> Date: Tue, 5 Jan 2016 10:15:10 +0000 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7bb03c1e3ffa930528938361 Subject: Re: [9fans] subtracting pointers on amd64 6c Topicbox-Message-UUID: 7e366c16-ead9-11e9-9d60-3106f5b1d025 --047d7bb03c1e3ffa930528938361 Content-Type: text/plain; charset=UTF-8 On 5 January 2016 at 06:36, wrote: > 1) why do we cast to long? > because that's the type all existing code expected, and there wasn't much application for > 4gb in single arrays at the time (as opposed to having big memory in big address spaces) > 2) if a pointer subtraction has to yield a long, why dont we cast *after* > the division? > that would be certainly be better. having said that, because of caching effects, especially on NUMA, it's worth looking at data structures that big to decide whether they might be better organised less naively. --047d7bb03c1e3ffa930528938361 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 5 January 2016 at 06:36, <cinap_lenrek@felloff.net> wrote:
1) why do we cast to long?
=

because that's the type all existing code expected,= and there wasn't much application
for > 4gb in single arr= ays at the time (as opposed to having big memory in big address spaces)
=C2=A0
2) if a pointer subtraction has to yield a long, why dont we cast *after* t= he division?

=C2=A0that would be = certainly be better.

having said that, because of = caching effects, especially on NUMA, it's worth looking at data structu= res that
big to decide whether they might be better organised les= s naively.
--047d7bb03c1e3ffa930528938361--