From d20ede40b1e9cd0539982fb1feb3b13af3501ea2 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 18 Jun 2019 20:53:21 -0400 Subject: NVServices: Styling, define constructors as explicit and corrections --- src/core/hle/service/nvdrv/nvdrv.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.h') diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index b7f692962..8f7c59a21 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -26,14 +26,15 @@ namespace Devices { class nvdevice; } -struct EventsInterface { +struct EventInterface { u64 events_mask{}; std::array events; std::array status{}; std::array registered{}; std::array assigned_syncpt{}; std::array assigned_value{}; - u32 GetFreeEvent() { + static constexpr u32 null_event = 0xFFFFFFFF; + u32 GetFreeEvent() const { u64 mask = events_mask; for (u32 i = 0; i < MaxNvEvents; i++) { const bool is_free = (mask & 0x1) == 0; @@ -44,12 +45,13 @@ struct EventsInterface { } mask = mask >> 1; } - return 0xFFFFFFFF; + return null_event; } void SetEventStatus(const u32 event_id, EventState new_status) { EventState old_status = status[event_id]; - if (old_status == new_status) + if (old_status == new_status) { return; + } status[event_id] = new_status; if (new_status == EventState::Registered) { registered[event_id] = true; @@ -102,9 +104,9 @@ public: void SignalSyncpt(const u32 syncpoint_id, const u32 value); - Kernel::SharedPtr GetEvent(const u32 event_id); + Kernel::SharedPtr GetEvent(u32 event_id) const; - Kernel::SharedPtr GetEventWriteable(const u32 event_id); + Kernel::SharedPtr GetEventWriteable(u32 event_id) const; private: /// Id to use for the next open file descriptor. @@ -116,7 +118,7 @@ private: /// Mapping of device node names to their implementation. std::unordered_map> devices; - EventsInterface events_interface; + EventInterface events_interface; }; /// Registers all NVDRV services with the specified service manager. -- cgit v1.2.3