linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jon Loeliger <jdl@freescale.com>
To: Jon Loeliger <jdl@jdl.com>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] DTC: Polish up the DTS Version 1 implementation.
Date: Thu, 08 Nov 2007 08:13:13 -0600	[thread overview]
Message-ID: <47331979.7030803@freescale.com> (raw)
In-Reply-To: <20071107231942.GA8835@localhost.localdomain>

David Gibson wrote:
> 
> Yes, I know, but I don't think it's even worth having the unused
> internal parameterization.

OK.  We can eliminate it then; no problem.

>
>> I ran my "old versus new DTC" comparison script and found it. :-)
> 
> Heh, we should fold that into the testsuite, too.

I'll start by simply adding the script to the test directory then.



>> Because it wasn't working, as explained in the comment I added.
>> Specifically, (1<<bits), with bits==64 overflowed and yielded
>> the value 0.
> 
> Ah...
> 
> Well, I assumed (1ULL << 64) would equal 0, which is why the
> comparison has the (-1) - I was expecting for bits == 64 it would end
> up being against -1, i.e. 0xffffffffffffffff.  This appears to work on
> the systems I've been using.

But not on an x86 system.

> But I just remembered that (x << n) has undefined behaviour in C when
> n >= word size. 

Exactly.  In fact, I think x86 takes the shift value, bit-wise
ANDs it with 63 internally, and then shifts left by that value.

 So I guess (1 << 64) is just returning garbage - I

In fact, it is yielding 1 on an x86 machine.

> suspect I didn't catch it because I've been building with -O0 for
> gdb-ability, which might change the behaviour of corner cases like
> that.

Or works on a PPC machine? :-)

> So I guess we need
> 	else if ((errno == ERANGE)
> 		 || ((bits < 64) && (val >= (1ULL << bits))))

Sounds good.  I'll commit --amend that into the patch!


>> And in the blue corner, touting consistent hex forms, ...
> 
> And in the red, compact bytestring representations.

> No, seriously, the inconsistency bothers me too.  But so does the fact
> that using 0x in the bytestring would double the minimum size for
> representing bytestrings, somewhat changing the flavour of [] as well
> (because spaces are no longer optional).  I'm looking for a killer
> argument one way or the other, but I haven't found it yet.

But why does it even have to be hex numbers at all?
I guess my point is that they could just be expressions.
You could use 0x31 or 49 or '1' or 061, whichever made
more sense in some application.  You don't necessarily take
a representational size hit.

jdl

  reply	other threads:[~2007-11-08 14:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06 22:19 [PATCH] DTC: Polish up the DTS Version 1 implementation Jon Loeliger
2007-11-06 23:11 ` David Gibson
2007-11-07 14:14   ` Jon Loeliger
2007-11-07 23:19     ` David Gibson
2007-11-08 14:13       ` Jon Loeliger [this message]
2007-11-09  0:13         ` David Gibson
2007-11-09 14:32           ` Jon Loeliger
2007-11-12  3:04             ` David Gibson
2007-11-08 19:18     ` DTS Bytestrings Representation in /dts-v1/ files Jon Loeliger
2007-11-08 19:33       ` Josh Boyer
2007-11-09  0:21       ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47331979.7030803@freescale.com \
    --to=jdl@freescale.com \
    --cc=jdl@jdl.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).