[RFC patch] Add support for snan/qnan/nan/inf for VAX

Nick Clifton nickc@redhat.com
Thu Apr 9 14:14:00 GMT 2009


Hi Matt,

> properly dealt with.  Anyone have a problem with the atof-generic.c 
> changes?

Nope, although...

>    switch (first_digit[0])
>      {
> +    case 's':
> +    case 'S':
> +      if (!strncasecmp ("snan", first_digit, 4))
> +    {
> +      address_of_generic_floating_point_number->sign = 0;
> +      address_of_generic_floating_point_number->exponent = 0;
> +      address_of_generic_floating_point_number->leader =
> +        address_of_generic_floating_point_number->low;
> +      *address_of_string_pointer = first_digit + 4;
> +      return 0;
> +    }
> +      break;
> +
> +    case 'q':
> +    case 'Q':
> +      if (!strncasecmp ("qnan", first_digit, 4))
> +    {
> +      address_of_generic_floating_point_number->sign = 0;
> +      address_of_generic_floating_point_number->exponent = 0;
> +      address_of_generic_floating_point_number->leader =
> +        address_of_generic_floating_point_number->low;
> +      *address_of_string_pointer = first_digit + 4;
> +      return 0;
> +    }
> +      break;

Could be more efficiently coded as:

>    switch (first_digit[0])
>      {
> +    case 's':
> +    case 'S':
> +    case 'q':
> +    case 'Q':
> +      if (!strncasecmp ("nan", first_digit + 1, 3))
> +    {
> +      address_of_generic_floating_point_number->sign = 0;
> +      address_of_generic_floating_point_number->exponent = 0;
> +      address_of_generic_floating_point_number->leader =
> +        address_of_generic_floating_point_number->low;
> +      *address_of_string_pointer = first_digit + 4;
> +      return 0;
> +    }
> +      break;


> 2009-04-01  Matt Thomas    <matt@netbsd.org>
> 
>     * atof-generic.c (atof_generic): recognize snan and qnan in
>     addition to nan and inf.
>     * atof-vax.c (flonum_gen2vax): deal properly with nan, snan, qnan,
>     and +Inf and -Inf codes.

Approved - please apply.

Cheers
  Nick



More information about the Binutils mailing list