Skip to content

Commit

Permalink
fwd: Add __MCF_UPTR_MAX and __MCF_IPTR_MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Jan 17, 2024
1 parent de9605e commit 4d1910f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mcfgthread/cond.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct __MCF_cond
{
uintptr_t __reserved_bits : 9;

#define __MCF_COND_NSLEEP_M (__UINTPTR_MAX__ >> 9)
#define __MCF_COND_NSLEEP_M (__MCF_UPTR_MAX >> 9)
uintptr_t __nsleep : __MCF_PTR_BITS - 9; /* number of sleeping threads */
};

Expand Down
2 changes: 1 addition & 1 deletion mcfgthread/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct __MCF_event
uintptr_t __value : 8;
uintptr_t __reserved_bits : 1;

#define __MCF_EVENT_NSLEEP_M (__UINTPTR_MAX__ >> 9)
#define __MCF_EVENT_NSLEEP_M (__MCF_UPTR_MAX >> 9)
uintptr_t __nsleep : __MCF_PTR_BITS - 9; /* number of sleeping threads */
};

Expand Down
10 changes: 8 additions & 2 deletions mcfgthread/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@
#endif

#ifdef _WIN64
# define __MCF_PTR_BITS 64
# define __MCF_PTR_BITS 64
# define __MCF_IPTR_MIN (-0x7FFFFFFFFFFFFFFF - 1)
# define __MCF_IPTR_MAX 0x7FFFFFFFFFFFFFFF
# define __MCF_UPTR_MAX 0xFFFFFFFFFFFFFFFFU
#else
# define __MCF_PTR_BITS 32
# define __MCF_PTR_BITS 32
# define __MCF_IPTR_MIN (-0x7FFFFFFF - 1)
# define __MCF_IPTR_MAX 0x7FFFFFFF
# define __MCF_UPTR_MAX 0xFFFFFFFFU
#endif

/* Standard support */
Expand Down
2 changes: 1 addition & 1 deletion mcfgthread/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct __MCF_mutex
#define __MCF_MUTEX_SP_NFAIL_M 15U
uintptr_t __sp_nfail : 4; /* number of timeouts after spinning */

#define __MCF_MUTEX_NSLEEP_M (__UINTPTR_MAX__ >> 9)
#define __MCF_MUTEX_NSLEEP_M (__MCF_UPTR_MAX >> 9)
uintptr_t __nsleep : __MCF_PTR_BITS - 9; /* number of sleeping threads */
};

Expand Down
2 changes: 1 addition & 1 deletion mcfgthread/once.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct __MCF_once
uintptr_t __ready : 8; /* this conforms to the Itanium C++ ABI */
uintptr_t __locked : 1;

#define __MCF_ONCE_NSLEEP_M (__UINTPTR_MAX__ >> 9)
#define __MCF_ONCE_NSLEEP_M (__MCF_UPTR_MAX >> 9)
uintptr_t __nsleep : __MCF_PTR_BITS - 9; /* number of sleeping threads */
};

Expand Down
2 changes: 1 addition & 1 deletion mcfgthread/sem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct __MCF_sem
};

/* This is the maximum value of a semaphore. */
#define __MCF_SEM_VALUE_MAX __INTPTR_MAX__
#define __MCF_SEM_VALUE_MAX __MCF_IPTR_MAX

/* Define a macro for static initialization of semaphores. The argument is the
* initial value of the semaphore, which shall not be negative. */
Expand Down

0 comments on commit 4d1910f

Please sign in to comment.