[PATCH v2 1/3] cpukit/aarch64: Add ESR register decoding

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 19 05:53:59 UTC 2021


On 18/03/2021 23:51, Kinsey Moore wrote:

> +void _binary_sprintf(
> +  char *s,
> +  size_t maxlen,
> +  uint32_t num_bits,
> +  uint32_t value
> +)
> +{
> +  uint32_t mask = 1<<(num_bits-1);
> +  int cx = 0;
> +
> +  while ( mask != 0 ) {
> +    cx += snprintf(s + cx, maxlen - cx, "%d", (value&mask ? 1 : 0));
> +    mask >>= 1;
> +  }
> +}
You can't use snprintf() in this context. Use _IO_Printf() instead. 
Maybe add a general wrapper for strings for this function.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list