Files
mercury/runtime/mercury_int.c
Mark Brown d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00

27 lines
638 B
C

// vim: ts=4 sw=4 expandtab ft=c
// Copyright (C) 2018 The Mercury team.
// This file is distributed under the terms specified in COPYING.LIB.
#include "mercury_int.h"
MR_Integer MR_hash_int64(int64_t i)
{
if (sizeof(int64_t) <= sizeof(MR_Integer)) {
return (MR_Integer) i;
} else {
// XXX We could experiment with a different mixing function here
// and below.
return (uint32_t)i ^ ((uint64_t)i >> 32);
}
}
MR_Integer MR_hash_uint64(uint64_t i)
{
if (sizeof(uint64_t) <= sizeof(MR_Integer)) {
return (MR_Integer) i;
} else {
return (uint32_t)i ^ (i >> 32);
}
}