This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
time64.c: Add a branch prediction for unlikely event
authorKarl Williamson <khw@cpan.org>
Mon, 16 Mar 2020 13:42:58 +0000 (07:42 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 19 Mar 2020 00:08:57 +0000 (18:08 -0600)
time64.c

index c848513..bbcef8e 100644 (file)
--- a/time64.c
+++ b/time64.c
@@ -518,7 +518,7 @@ struct TM *Perl_localtime64_r (const Time64_T *time, struct TM *local_tm)
      * when appropriate */
     result = localtime(&safe_time);
 
-    if( result == NULL ) {
+    if(UNLIKELY(result == NULL)) {
         LOCALTIME_UNLOCK;
         TIME64_TRACE1("localtime(%d) returned NULL\n", (int)safe_time);
         return NULL;