Nmap Development mailing list archives
[PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc
From: Kris Katterjohn <kjak () ispwest com>
Date: Sat, 02 Sep 2006 22:17:16 -0500
The attached patch just uses sqrt() instead of pow(,0.5) on everything instead of just Linux in osscan.cc and osscan2.cc. Apparently (judging by the comment in osscan.cc), sqrt() is used on Linux because pow() is broken in some libc versions. sqrt(X) is the same as pow(X,0.5), so we can just use sqrt() and avoid the #ifdef. It's a diff against 4.20ALPHA6 Thanks, Kris Katterjohn
--- x/osscan.cc 2006-08-28 22:26:10.000000000 -0500 +++ y/osscan.cc 2006-09-02 22:04:38.000000000 -0500 @@ -959,13 +959,7 @@ static FingerPrint *get_fingerprint(Targ /* printf("The sequence sum is %e\n", seq_inc_sum);*/ seq_inc_sum /= (si->responses - 1); - /* Some versions of Linux libc seem to have broken pow ... so we - avoid it */ -#ifdef LINUX si->index = (unsigned int) (0.5 + sqrt(seq_inc_sum)); -#else - si->index = (unsigned int) (0.5 + pow(seq_inc_sum, 0.5)); -#endif /* printf("The sequence index is %d\n", si->index);*/ if (si->index < 75) { --- x/osscan2.cc 2006-09-02 20:11:42.000000000 -0500 +++ y/osscan2.cc 2006-09-02 22:04:45.000000000 -0500 @@ -1735,11 +1735,7 @@ void HostOsScan::makeTSeqFP(HostOsScanSt seq_stddev /= hss->si.responses - 2; /* Next we need to take the square root of this value */ -#ifdef LINUX seq_stddev = (unsigned int) (0.5 + sqrt(seq_stddev)); -#else - seq_stddev = (unsigned int) (0.5 + pow(seq_stddev, 0.5)); -#endif /* Finally we take a binary logarithm, multiply by 8, and round to get the final result */
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Kris Katterjohn (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Fyodor (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Kris Katterjohn (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Fyodor (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Kris Katterjohn (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Andreas Ericsson (Sep 04)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Kris Katterjohn (Sep 02)
- Re: [PATCH] Change pow(, 0.5) -> sqrt() in osscan[2].cc Fyodor (Sep 02)