included copied functions from lib/ewma.c as there seems to be kernels without them