From 7a3b00b10b6a5a740e07fc1b68a4f3fb3bcdac23 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 27 Sep 2016 18:20:02 +0200 Subject: Introduce tolower_ascii_unsafe() and use it for hashing This one has some obvious collisions for non-alphabetical characters, like some control characters also hashing to numbers, but we don't really have those, and these are hash functions which are not collision free to begin with. --- apt-pkg/contrib/strutl.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index f3591d65f..918ac89c7 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -140,6 +140,11 @@ bool CheckDomainList(const std::string &Host, const std::string &List); #define tolower_ascii tolower_ascii_inline #define isspace_ascii isspace_ascii_inline +APT_CONST APT_HOT +static inline int tolower_ascii_unsafe(int const c) +{ + return c | 0x20; +} APT_CONST APT_HOT static inline int tolower_ascii_inline(int const c) { -- cgit v1.2.3