Skip to content
Snippets Groups Projects
Commit c5f80cf3 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

Merge branch 'bugfix/64bit-type-for-DDD_GID' into 'master'

Ensure `DDD_GID` is at least 64 bits wide

a0cf9c01 increased `MAX_PROCBITS_IN_GID`
from 9 to 24.  As an `unsigned long` is only 32 bits wide on common
32 bit architectures, this left only 8 bits instead of the intended
40 bits (on 64 bit architectures) for objects.

This patch makes sure the `DDD_GID` type is at least 64 bits by using
the `std::uint_least64_t` type.  It should fix the build failure on, for
example, [i386] and [PowerPC].

  [i386]: https://buildd.debian.org/status/fetch.php?pkg=dune-grid&arch=i386&ver=2.5.0%7Erc1-1&stamp=1480684720
  [PowerPC]: https://buildd.debian.org/status/fetch.php?pkg=dune-grid&arch=s390x&ver=2.5.0%7Erc1-1&stamp=1480658113

See merge request !38
parents d946fb58 50d90823
No related branches found
No related tags found
1 merge request!38Ensure `DDD_GID` is at least 64 bits wide
Pipeline #
......@@ -48,6 +48,7 @@
/* for size_t */
#include <cstddef>
#include <cinttypes>
#include "namespace.h"
......@@ -243,7 +244,7 @@ enum TMemRequests {
#ifdef DDD_GID_DEBUG
struct ddd_gid_debug
{
unsigned int val;
std::uint_least64_t val;
/* ddd_gid_debug(unsigned int v) : val(v) {} */
/* ddd_gid_debug() : val(0) {} */
bool operator < (const ddd_gid_debug & other) { return val < other.val; }
......@@ -268,10 +269,10 @@ typedef ddd_gid_debug DDD_GID;
#ifdef DDD_GID_T
typedef DDD_GID_T DDD_GID;
#else
typedef unsigned long DDD_GID;
#define DDD_GID_FMT "%08lx"
typedef std::uint_least64_t DDD_GID;
#define DDD_GID_FMT "%08" PRIxLEAST64
#endif
#define DDD_GID_TO_INT(A) (unsigned int) A
#define DDD_GID_TO_INT(A) (A)
#endif
typedef unsigned int DDD_TYPE;
typedef unsigned int DDD_IF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment