moved min max functions to func.c

Signed-off-by: Alexander Skjolden <alex@plastboks.net>