httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@decus.org (Rodent of Unusual Size)
Subject Re: Agenda for 1.2b7
Date Thu, 06 Feb 1997 15:19:25 GMT
>From the fingers of Marc Slemko flowed the following:
>
>On Thu, 6 Feb 1997, Rodent of Unusual Size wrote:
>
>> >From the fingers of Marc Slemko flowed the following:
>> >
>> >On Wed, 5 Feb 1997, Dean Gaudet wrote:
>> >
>> >> >   * 64-bit issues; general cleanup, ap_snprintf("%d", (int)-1) giving
>> >> >     wrong behavior on Alpha boxes.
>> >> 
>> >> I'm still waiting for a description of the error...
>> >
>> >ap_snprintf(foo, "%d", (int)-1) should give (2^32)-1 on the Alpha, since
>> >even though it is 64 bit ints are still 32-bit.  It gives (2^64)-1.
>> 
>>     I must be missing something.  The above (with a len argument
>>     added) gives me the output of "-1" on my Alpha box.  What's wrong
>>     with that?
>
>Sorry, mean unsigned int.  something like %u and (unsigned int)...

    Ah, now I see.  Looking at the code, I have no idea why it would be
    doing that, unless the compiler *really* wants to always sign-extend
    and use the whole width when a register is referenced.  However,
    removing the `register' clause on the declaration of "magnitude"
    doesn't change things, nor does disabling all optimisations.  {Sigh}

    If it's safe to assume that a WIDE_INT (namely, a long) is always 32
    bits, the [tested] patch below will fix this.  I'm not
    multi-platform aware enough to be sure that's a valid assumption,
    though.

    #ken    :-)}

Index: util_snprintf.c
===================================================================
RCS file: /usr/users/coar/myApache/repository/apache/src/util_snprintf.c,v
retrieving revision 1.4
diff -c -r1.4 util_snprintf.c
*** 1.4	1997/01/20 23:55:11
--- util_snprintf.c	1997/02/06 15:14:22
***************
*** 360,366 ****
      register u_wide_int magnitude;
  
      if (is_unsigned) {
! 	magnitude = (u_wide_int) num;
  	*is_negative = FALSE;
      }
      else {
--- 360,366 ----
      register u_wide_int magnitude;
  
      if (is_unsigned) {
! 	magnitude = (u_wide_int) num & 0xFFFFFFFF;
  	*is_negative = FALSE;
      }
      else {

Mime
View raw message