mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Move gcd_n_uint to osscan2.cc.
This commit is contained in:
22
osscan2.cc
22
osscan2.cc
@@ -2175,6 +2175,28 @@ bool ScanStats::sendOK() {
|
|||||||
* Implementation of class HostOsScan *
|
* Implementation of class HostOsScan *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
static unsigned int gcd_n_uint(int nvals, unsigned int *val) {
|
||||||
|
unsigned int a, b, c;
|
||||||
|
|
||||||
|
if (!nvals)
|
||||||
|
return 1;
|
||||||
|
a = *val;
|
||||||
|
for (nvals--; nvals; nvals--) {
|
||||||
|
b = *++val;
|
||||||
|
if (a < b) {
|
||||||
|
c = a;
|
||||||
|
a = b;
|
||||||
|
b = c;
|
||||||
|
}
|
||||||
|
while (b) {
|
||||||
|
c = a % b;
|
||||||
|
a = b;
|
||||||
|
b = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
|
void HostOsScan::makeTSeqFP(HostOsScanStats *hss) {
|
||||||
int i, j;
|
int i, j;
|
||||||
u32 seq_diffs[NUM_SEQ_SAMPLES];
|
u32 seq_diffs[NUM_SEQ_SAMPLES];
|
||||||
|
|||||||
22
utils.cc
22
utils.cc
@@ -267,28 +267,6 @@ int Send(int sd, const void *msg, size_t len, int flags) {
|
|||||||
return (res < 0) ? -1 : (int) len;
|
return (res < 0) ? -1 : (int) len;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gcd_n_uint(int nvals, unsigned int *val) {
|
|
||||||
unsigned int a, b, c;
|
|
||||||
|
|
||||||
if (!nvals)
|
|
||||||
return 1;
|
|
||||||
a = *val;
|
|
||||||
for (nvals--; nvals; nvals--) {
|
|
||||||
b = *++val;
|
|
||||||
if (a < b) {
|
|
||||||
c = a;
|
|
||||||
a = b;
|
|
||||||
b = c;
|
|
||||||
}
|
|
||||||
while (b) {
|
|
||||||
c = a % b;
|
|
||||||
a = b;
|
|
||||||
b = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function takes a command and the address of an uninitialized char **. It
|
/* This function takes a command and the address of an uninitialized char **. It
|
||||||
parses the command (by separating out whitespace) into an argv[]-style
|
parses the command (by separating out whitespace) into an argv[]-style
|
||||||
char **, which it sets the argv parameter to. The function returns the number
|
char **, which it sets the argv parameter to. The function returns the number
|
||||||
|
|||||||
2
utils.h
2
utils.h
@@ -175,8 +175,6 @@ char *chomp(char *string);
|
|||||||
|
|
||||||
int Send(int sd, const void *msg, size_t len, int flags);
|
int Send(int sd, const void *msg, size_t len, int flags);
|
||||||
|
|
||||||
unsigned int gcd_n_uint(int nvals, unsigned int *val);
|
|
||||||
|
|
||||||
int arg_parse(const char *command, char ***argv);
|
int arg_parse(const char *command, char ***argv);
|
||||||
void arg_parse_free(char **argv);
|
void arg_parse_free(char **argv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user