MB-9979 Add generic minimum function.

Change-Id: Id848e249b1fa7c5ffb059055d356ea37e2f3b6b5
Reviewed-on: http://review.couchbase.org/34219
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>