Re: RFC: Representation of large hex values

From: Joe Korty (joe.korty_at_ccur.com)
Date: 01/24/04

  • Next message: john cherry: "IA64 (2.6.2-rc1 - 2004-01-23.17.30) - 1 New warnings (gcc 3.3.1)"
    Date:	Sat, 24 Jan 2004 10:55:06 -0500
    To: "Dr. David Alan Gilbert" <gilbertd@treblig.org>
    
    

    On Sat, Jan 24, 2004 at 03:30:12PM +0000, Dr. David Alan Gilbert wrote:
    > (OK, this isn't strictly a kernel thing - but it seems to be a good
    > place for peoples thoughts on this, and the kernel would be one
    > place to start it off)
    >
    > The problem: Large (64 bit) hex values are cumbersome - especially
    > when they contain strings of 0's in the middle
    >
    > Suggestion: Print hex value with a seperator every 4 or 8 nybbles
    > to aid in counting. After some discussion it seems that _
    > is a decent seperator - e.g.
    >
    > 1000_0000_0000_1234
    >
    > this is especially useful when you have a pile of numbers like
    >
    > 1000000021771245
    >
    > and you are trying to see if that is bigger or smaller than
    > the number 1000000232349876, yet it is pretty obvious when you
    > try and compare 1000_0000_2177_1245 and 1000_0002_3234_9876.
    >
    > I originally thought of using : like IPv6 but this can get
    > in the way on languages which use : for other things.
    > (and I don't think it is worth doing packed numbers like IPv6
    > does - i.e. 1000_0_2177_1245 would be invalid).
    >
    > For clarity, it would seem best to use a distinct format character;
    > so perhaps prefix these numbers by 0y (read Oi!) and then you
    > could use %y (and %Y if you REALLY want) in printf. Scanf equivalents
    > would be taught to understand both formats; using 0y and _ makes
    > code that doesn't understand the format fail noisily. So:
    >
    > 0ydead_beef_1ced_ac1d
    >
    > I don't think there is the necessity to force zero padding, so
    > 1_2177_1245 is valid; but _ shall not be the first character
    > (so as not to construct an identifier). (I'm vaguely remembering
    > that VHDL allows _ padding?)
    >
    > If people like this then I'd be happy to write a modified
    > printf/scanf, and I suggest that it gets used in limited places
    > until the same could be integrated in gdb/binutils/other tools.
    >
    > Suggestions and constructive comments welcome and apologies
    > for disturbing your games of wack-the-penguin.

    Hi David,
    2.6.1-mm4 has a variant of this, limited to bitmaps and using the
    comma as the seperator. See bitmap_parse and bitmap_snprintf in
    lib/bitmap.c

    Replacing the comma with the underscore and moving the whole shebang
    to printf/scanf sounds like a good idea to me. Printf *should* be
    able to manipulate bitmaps just as it does for other basics types
    like strings and ints.

    Why don't you whip up a patch and see what happens?

    Regards,
    Joe
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: john cherry: "IA64 (2.6.2-rc1 - 2004-01-23.17.30) - 1 New warnings (gcc 3.3.1)"

    Relevant Pages

    • Re: [BENCHMARK] nproc: netlink access to /proc information
      ... > strings is expensive. ... /proc performance does not scale if we have to ... as I see that the internal algorithms actually dominate the runtime ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] JFS: sane file name handling (0 of 2)
      ... the second one changes the default translation of filenames into unicode. ... the character set of the file names rather than just treating them as strings ... while still allowing the charset-specific behavior with the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Comma in Web Part parameters
      ... I have two webparts, one providing to strings, the other one reciving the two strings. ... If I have a comma in the first parameter the parameter is striped after the comma and the second parameter is empty. ... In my logfiles I can see, that the first web part fires his event with the correct parameters but the second one recives the corrupted data. ...
      (microsoft.public.sharepoint.portalserver.development)
    • Re: IBM Thinkpad T42 - Looking for a Developer.
      ... >> they completely freely distributable or are there strings attached? ... The more useful one tells that there are two possible interfaces: ... - USB ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linuxant/Conexant HSF/HCF Modem Drivers Unlocked
      ... Chad Christopher Giffin wrote: ... > I couldn't help but notice that the Linuxant Modem drivers appear to be ... as a strings of the modules shows that License=GPL. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)