uint8_t print woes

I'm trying to get some library and test code that I grabbed from a website to run. I've added Serial.print statements to the test code (and removed LED write statements):

#include "fast_hsv2rgb.h"

uint16_t hue;
uint8_t  val;
int8_t   dir;
uint8_t  prevtime;

void setup()
{
  Serial.begin(9600);
  
  hue = HSV_HUE_MIN;
  val = HSV_VAL_MAX;
  dir = -3;
  prevtime = millis();
}

void loop()
{
  uint8_t r, g, b;
  uint8_t now = millis();
  uint8_t tdiff = now - prevtime;

  if(tdiff >= 5) {
    prevtime = now;   // Change color every 5ms

    hue++;      // Increase hue to circle and wrap
    if(hue > HSV_HUE_MAX)
      hue -= HSV_HUE_MAX;

    val += dir;   // Vary value between 1/4 and 4/4 of HSV_VAL_MAX
    if(val < HSV_VAL_MAX / 4 || val == HSV_VAL_MAX)
      dir = -dir; // Reverse value direction

    // Perform conversion at fully saturated color
    fast_hsv2rgb_32bit(hue, HSV_SAT_MAX, val, &r, &g, &b);

    Serial.print("r = ");
    Serial.print(r);
    Serial.print(" g = ");
    Serial.print(g);
    Serial.print(" b = ");
    Serial.println(b);
  }
}

The first few lines of output are:

r = 0 g = 0 b = 0
09:34:36.821 -> r = 0 g = 0 b = 0
09:34:36.821 -> r = 0 g = 0 b = 0
09:34:36.859 -> r = 0 g = 0 b = 6
09:34:36.859 -> r = 0 g = 0 b = 1542
09:34:36.893 -> r = 0 g = 0 b = 394758
09:34:36.930 -> r = 0 g = 0 b = 101058054
09:34:36.964 -> r = 0 g = 6 b = 101058054
09:34:36.964 -> r = 0 g = 1542 b = 101058054
09:34:36.999 -> r = 0 g = 394758 b = 101058054
09:34:37.036 -> r = 0 g = 101058054 b = 101058054

Why am I getting those huge numbers? My understanding of uint8_t is an unsigned 8-bit integer, which should have a maximum value of 255. Can someone explain this to me? Thanks!

This may or may not help, but...

uint8_t now = millis();

I am not familiar with all Unix data types, but uint8_t is the same as an unsigned byte in Arduino. millis() returns an unsigned long.

If you don't need the portability that comes from using Unix types, the Arduino types are more commonly used here.

Maybe you should be calling fast_hsv2rgb_8bit(hue, HSV_SAT_MAX, val, &r, &g, &b); instead of fast_hsv2rgb_32bit(hue, HSV_SAT_MAX, val, &r, &g, &b);

prevTime, and all millis associated values should bu unsigned longs.
Using uint8 will overflow every quarter of a second!

Turns out it doesn't matter if you call fast_hsv2rgb_8bit() or fast_hsv2rgb_32bit(). The problem is the same either way.

The fix is to open "fast_hsv2rgb.h" and comment out the line:

#define HSV_USE_ASSEMBLY  /* Optimize code using assembly */