librpc: Remove usage of max and replace with improved range.