Commit 8c494837 authored by Mac Newbold's avatar Mac Newbold

Add a max and min func to libdb and remove local ones in a few places.

parent acffab8a
......@@ -55,7 +55,7 @@ use Exporter;
TB_IMAGEID_READINFO TB_IMAGEID_MODIFYINFO
TB_IMAGEID_CREATE TB_IMAGEID_DESTROY
TB_IMAGEID_ACCESS TB_IMAGEID_MIN TB_IMAGEID_MAX
DBLIMIT_NSFILESIZE NODERELOADPENDING_EID
EXPTSTATE_NEW EXPTSTATE_PRERUN EXPTSTATE_SWAPPED EXPTSTATE_SWAPPING
......@@ -151,6 +151,8 @@ use Exporter;
TBSiteVarExists TBGetSiteVar
TBActivityReport GatherSwapStats GatherAssignStats
max min
);
# Must come after package declaration!
......@@ -3483,6 +3485,14 @@ sub GatherAssignStats($$%)
"where idx=$rsrcidx");
}
sub max ( $$ ) {
return ($_[0] > $_[1] ? $_[0] : $_[1]);
}
sub min ( $$ ) {
return ($_[0] < $_[1] ? $_[0] : $_[1]);
}
# _Always_ make sure that this 1 is at the end of the file...
1;
......
......@@ -2351,20 +2351,6 @@ exit 0;
# Subroutines
######################################################################
# min(a,b)
# Returns the minimum of a and b.
sub min {
my ($a,$b) = @_;
return ($a < $b ? $a : $b);
};
# max(a,b)
# Returns the minimum of a and b.
sub max {
my ($a,$b) = @_;
return ($a > $b ? $a : $b);
};
# getbandwidth(bw)
# Returns the lowest ok bandwidth that is greater than or equal to
# the one passed.
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -672,12 +672,6 @@ sub combineloss {
return (1.0 - ((1.0 - $a) * (1.0 - $b)));
}
sub min {
my ($a, $b) = @_;
if ($a < $b) { return $a; }
return $b;
}
sub ceil {
my ($a) = @_;
my $b = sprintf("%i",$a);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment