Skip to content

Commit

Permalink
starboard/types.h: Remove kSbInvalidInt
Browse files Browse the repository at this point in the history
By inlining the necessary min-int equivalent.

b/366064934
  • Loading branch information
yell0wd0g committed Nov 6, 2024
1 parent 232171b commit 4720a40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion starboard/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef STARBOARD_DRM_H_
#define STARBOARD_DRM_H_

#include <limits>

#include "starboard/export.h"
#include "starboard/types.h"

Expand Down Expand Up @@ -220,7 +222,7 @@ typedef void (*SbDrmServerCertificateUpdatedFunc)(SbDrmSystem drm_system,
#define kSbDrmSystemInvalid ((SbDrmSystem)NULL)

// A ticket for callback invocations initiated by the DRM system.
#define kSbDrmTicketInvalid kSbInvalidInt
#define kSbDrmTicketInvalid std::numeric_limits<int>::min()

// --- Functions -------------------------------------------------------------

Expand Down
10 changes: 9 additions & 1 deletion starboard/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#include <pthread.h>

#include <limits>
#include <utility>

#include "starboard/configuration.h"
#include "starboard/export.h"
#include "starboard/types.h"
Expand All @@ -29,6 +32,7 @@
extern "C" {
#endif

using kEnumType = int;
// A spectrum of thread priorities. Platforms map them appropriately to their
// own priority system. Note that scheduling is platform-specific, and what
// these priorities mean, if they mean anything at all, is also
Expand Down Expand Up @@ -73,9 +77,13 @@ typedef enum SbThreadPriority {
// default priority assignment method of that platform. This may mean to
// inherit the priority of the spawning thread, or it may mean a specific
// default priority, or it may mean something else, depending on the platform.
kSbThreadNoPriority = kSbInvalidInt,
kSbThreadNoPriority = std::numeric_limits<kEnumType>::min(),
} SbThreadPriority;

static_assert(
std::is_same<std::underlying_type_t<SbThreadPriority>, kEnumType>::value ==
true);

// An ID type that is unique per thread.
typedef int32_t SbThreadId;

Expand Down
3 changes: 0 additions & 3 deletions starboard/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ typedef int64_t ssize_t;
#endif
#endif // !SB_HAS(SSIZE_T)

// A value that represents an int that is probably invalid.
#define kSbInvalidInt INT32_MIN

// --- Standard Include Emulation Audits ---------------------------------------

#if (UINT_MIN + 1 == UINT_MAX - 1) || (INT_MIN + 1 == INT_MAX - 1) || \
Expand Down

0 comments on commit 4720a40

Please sign in to comment.