mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-01 09:55:29 +03:00
Use pragma pack directions for tightly packing structs containing u128
Using `__attribute__((packed))` doesn't work in new NDKs when a struct contains 128-bit integer members, likely because of a ndk/compiler bug. We now enclose the requiring structs in `#pragma pack` directives to tightly pack them.
This commit is contained in:
parent
c4bf92a49f
commit
e9618d9e2c
@ -60,11 +60,17 @@ namespace skyline::service::timesrv {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using __attribute__((packed)) doesn't work in new NDKs when a struct contains 128-bit integer members, likely because of a ndk/compiler bug
|
||||||
|
* Use #pragma pack to ensure that the following structs are tightly packed
|
||||||
|
*/
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Holds details about a point in time sourced from a steady clock (e.g. RTC)
|
* @brief Holds details about a point in time sourced from a steady clock (e.g. RTC)
|
||||||
* @url https://switchbrew.org/w/index.php?title=PSC_services#SteadyClockTimePoint
|
* @url https://switchbrew.org/w/index.php?title=PSC_services#SteadyClockTimePoint
|
||||||
*/
|
*/
|
||||||
struct __attribute__((packed)) SteadyClockTimePoint {
|
struct SteadyClockTimePoint {
|
||||||
i64 timePoint; //!< Time in seconds
|
i64 timePoint; //!< Time in seconds
|
||||||
UUID clockSourceId; //!< The UUID of the steady clock this timepoint comes from
|
UUID clockSourceId; //!< The UUID of the steady clock this timepoint comes from
|
||||||
|
|
||||||
@ -76,7 +82,7 @@ namespace skyline::service::timesrv {
|
|||||||
* @brief Describes a system clocks offset from its associated steady clock
|
* @brief Describes a system clocks offset from its associated steady clock
|
||||||
* @url https://switchbrew.org/w/index.php?title=PSC_services#SystemClockContext
|
* @url https://switchbrew.org/w/index.php?title=PSC_services#SystemClockContext
|
||||||
*/
|
*/
|
||||||
struct __attribute__((packed)) SystemClockContext {
|
struct SystemClockContext {
|
||||||
i64 offset; // Offset between the steady timepoint and the epoch
|
i64 offset; // Offset between the steady timepoint and the epoch
|
||||||
SteadyClockTimePoint timestamp; //!< The steady timepoint this context was calibrated from
|
SteadyClockTimePoint timestamp; //!< The steady timepoint this context was calibrated from
|
||||||
|
|
||||||
@ -84,6 +90,8 @@ namespace skyline::service::timesrv {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(SystemClockContext) == 0x20);
|
static_assert(sizeof(SystemClockContext) == 0x20);
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A particular time point in Nintendo's calendar format
|
* @brief A particular time point in Nintendo's calendar format
|
||||||
* @url https://switchbrew.org/w/index.php?title=PSC_services#CalendarTime
|
* @url https://switchbrew.org/w/index.php?title=PSC_services#CalendarTime
|
||||||
|
Loading…
Reference in New Issue
Block a user