From bbb4a1a70f6a14b2087e2f7c33ce12b882da87a0 Mon Sep 17 00:00:00 2001 From: tg Date: Mon, 25 Jan 2010 14:29:34 +0000 Subject: [PATCH] add Loaathash1 (iv=0x100 ipv 0) --- dot.mkshrc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dot.mkshrc b/dot.mkshrc index c7341e0..ef12e05 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,7 +1,7 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.52 2009/12/12 22:27:14 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.53 2010/01/25 14:29:34 tg Exp $ #- -# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009 +# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 # Thorsten Glaser # # Provided that these terms and disclaimer and all copyright notices @@ -310,14 +310,21 @@ function Loaathash_add { (( u )) || set -U } -function Loaathash { - Loaathash_result=0 # hmm... +function Loaathash_do { Loaathash_add "$@" ((# Loaathash_result += Loaathash_result << 3 )) ((# Loaathash_result = (Loaathash_result ^ (Loaathash_result >> 11)) * 32769 )) print ${Loaathash_result#16#} } +function Loaathash { + Loaathash_result=0 + Loaathash_do "$@" +} +function Loaathash1 { + Loaathash_result=0x100 + Loaathash_do "$@" +} # strip comments (and leading/trailing whitespace if IFS is set) from # any file(s) given as argument, or stdin if none, and spew to stdout