A portable and reasonably efficient implementation of KL1 - Chikayama, Takashi (1992)