[PATCH] Support HWCAPs for MIPS

Mike Frysinger vapier@gentoo.org
Fri Mar 6 11:38:00 GMT 2015


On 14 Oct 2014 21:51, Matthew Fortune wrote:
> +static inline int
> +__attribute__ ((unused))
> +_dl_procinfo (unsigned int type, unsigned long int word)

i think we just use "unsigned long".  pairing "int" with "long" is just a waste 
of space.

> +{
> +  int i;
> +
> +  /* Fallback to unknown output mechanism.  */
> +  if (type == AT_HWCAP2)
> +    return -1;
> +
> +  _dl_printf ("AT_HWCAP:   ");
> +
> +  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
> +    if (word & (1 << i))

i is an int, but word is an unsigned long int.  probably want to harmonize those 
types.

> +static inline const char *
> +__attribute__ ((unused))
> +_dl_hwcap_string (int idx)
> +{
> +  return GLRO(dl_mips_cap_flags)[idx];
> +};

no trailing semi-colons on func defs

> +static inline int
> +__attribute__ ((unused))
> +_dl_string_hwcap (const char *str)
> +{
> +  int i;
>  
> -#define _dl_string_hwcap(str) (-1)
> +  for (i = 0; i < _DL_HWCAP_COUNT; i++)

nit: ++i

> +    {
> +      if (strcmp (str, GLRO(dl_mips_cap_flags)[i]) == 0)
> +	return i;
> +    }

no need for the braces

> +  return -1;

GNU style says to put a blank line above the return

> +};

no trailing semi-colons on func defs
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150306/7fb332f0/attachment.sig>


More information about the Libc-alpha mailing list