guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: system: vm: Use 2^32 - 1 as hash size.


From: Mathieu Othacehe
Subject: 01/01: system: vm: Use 2^32 - 1 as hash size.
Date: Mon, 6 Nov 2017 14:03:04 -0500 (EST)

mothacehe pushed a commit to branch master
in repository guix.

commit b1a30793477c705a136546798d8e1d27802dd4b7
Author: Mathieu Othacehe <address@hidden>
Date:   Fri Nov 3 13:40:07 2017 +0100

    system: vm: Use 2^32 - 1 as hash size.
    
    * gnu/system/vm.scm (operating-system-uuid): Use 2^32 - 1 instead of
      2^32 as hash size.
    
    On some 32 bit system (ARM for example), 2^32 exceeds hash max
    size (ULONG_MAX = 2^32 - 1).
---
 gnu/system/vm.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3127b30..4424608 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -372,13 +372,13 @@ TYPE (one of 'iso9660 or 'dce).  Return a UUID object."
       (bytevector->uuid
        (uint-list->bytevector
         (list (hash file-system-type
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-host-name os)
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-services os)
-                    (expt 2 32))
+                    (- (expt 2 32) 1))
               (hash (operating-system-file-systems os)
-                    (expt 2 32)))
+                    (- (expt 2 32) 1)))
         (endianness little)
         4)
        type)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]