firmware: Move rand16() to utils.{c,h}

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2023-03-14 09:03:43 +01:00
parent 453b3edb26
commit ebc8a810c7
3 changed files with 12 additions and 8 deletions

View File

@ -13,6 +13,7 @@
#include "config.h"
#include "pmu.h"
#include "utils.h"
/*
@ -73,14 +74,6 @@ static struct {
static uint32_t rng = 1234;
static uint16_t rand16()
{
rng = (rng * 22695477) + 1;
return rng >> 12;
}
static const uint16_t cie[] = {
1156, 3468, 5703, 7651, 9253, 10628, 11843, 12938,
13938, 14863, 15724, 16533, 17295, 18018, 18705, 19362,

View File

@ -44,3 +44,12 @@ hexval(char c)
else
return 0;
}
uint16_t
rand16()
{
static uint32_t rng = 1234;
rng = (rng * 22695477) + 1;
return rng >> 12;
}

View File

@ -11,3 +11,5 @@
char *hexstr(void *d, int n, bool space);
uint8_t hexval(char c);
uint16_t rand16();