I want to know how the mix function works in the mix rgb code void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
  fac = clamp(fac, 0.0, 1.0);
  outcol = **mix**(col1, col2, fac);
  outcol.a = col1.a;
}

I want to know how the mix works in the code above.
I think it's a function, but I can't find where it is.
I think blender is mixing by adjusting col1, col2, and fac value, but I want to know the detailed logic.
void mix_mult(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
  fac = **clamp**(fac, 0.0, 1.0);
  outcol = mix(col1, col1 * col2, fac);
  outcol.a = col1.a;
}

I want to know how the clamp function works in the code above.
source code
material.c
ctrl+f &quot;blend&quot;
https://github.com/blender/blender/blob/master/source/blender/blenkernel/intern/material.c