Branch: Tag:

2012-07-07

2012-07-07 00:18:23 by Martin Stjernholm <mast@lysator.liu.se>

Optimization safe fix for formatting Int.NATIVE_MIN.

Signed overflows aren't defined, so gcc is free to optimize away the
second comparison. Amends c0d5e154.

492:    {    char buf[21], *b = buf + (sizeof (buf) - 2);    int neg, j=0; -  INT_TYPE i = Pike_sp[-1].u.integer; -  if( i < 0 ) +  unsigned INT_TYPE i = Pike_sp[-1].u.integer; +  if( Pike_sp[-1].u.integer < 0 )    {    neg = 1; -  i = -i; -  if (i < 0) { -  /* The largest negative number cannot be negated. */ -  o_cast_to_string(); -  return; +  i = -i; /* Always defined for unsigned - signed overflows are not. */    } -  } +     else    neg = 0;    pop_stack();