memcmp.3: note about optimization to bcmp in LLVM 9
PATCH 1/1 memcmp.3: note about optimization to bcmp in LLVM 9
--- man3/memcmp.3 | 7 +++++++ 1 file changed, 7 insertions(+)
man3/memcmp.3 +7 -0
@@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes. Instead, a function that performs comparisons in constant time is required. Some operating systems provide such a function (e.g., NetBSD's .BR consttime_memequal ()), but no such function is specified in POSIX. On Linux, it may be necessary to implement such a function oneself. +.PP +LLVM 9, released in 2019, and later will optimize a call +.BR memcmp () +to a call to +.BR bcmp (3) +if the return value is only checked for equilivence to zero. +.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations .SH SEE ALSO .BR bcmp (3), .BR bstring (3), .BR strcasecmp (3), .BR strcmp (3),
Signature · 1 line
2.20.1
11.01.2020, 10:02, "Shawn Landden" <[email protected]>:
Quoted 9 lines
---
man3/memcmp.3 | 7 +++++++1 file changed, 7 insertions(+)man3/memcmp.3 +0
-0@@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes.
Quoted 7 lines
Instead, a function that performs comparisons in constant time is required. Some operating systems provide such a function (e.g., NetBSD's .BR
consttime_memequal()),
but no such function is specified in POSIX.
On Linux, it may be necessary to implement such a function oneself. +.PP
+LLVM 9, released in 2019, and later will optimize a call
to
Quoted 12 lines
+.BR memcmp ()
man3/memcmp.3 +4
-0+to a call to +.BR bcmp (3) +if the return value is only checked for equilivence to zero. +.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations.SH SEE ALSO
.BR bcmp (3),
.BR bstring (3),
.BR strcasecmp (3),
.BR strcmp (3),
--
2.20.1
Signature · 1 line
Shawn Landden
Quoted 11 lines · Shawn Landden
--- man3/memcmp.3 | 7 +++++++ 1 file changed, 7 insertions(+)man3/memcmp.3 +0
-0@@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes. Instead, a function that performs comparisons in constant time is required. Some operating systems provide such a function (e.g., NetBSD's
man3/memcmp.3 because the required CPU time depends on the number of equal bytes. · line 95
Quoted 10 lines
man3/memcmp.3 +7
-0.BR consttime_memequal ()), but no such function is specified in POSIX. On Linux, it may be necessary to implement such a function oneself. +.PP +LLVM 9, released in 2019, and later will optimize a call +.BR memcmp () +to a call to +.BR bcmp (3) +if the return value is only checked for equilivence to zero. +.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations
See my othermail. Wht is it relevant to document this compiler-specific detail?
Thanks,
Michael
Quoted 6 lines
man3/memcmp.3 +0
-0.SH SEE ALSO .BR bcmp (3), .BR bstring (3), .BR strcasecmp (3), .BR strcmp (3),
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/