PrimeFilter port to Cpp