瀏覽代碼

fix: remove constexpr from some function decl.

greatbridf 11 月之前
父節點
當前提交
735b7988b3
共有 2 個文件被更改,包括 12 次插入14 次删除
  1. 4 5
      include/kernel/mm.hpp
  2. 8 9
      include/types/bitmap.hpp

+ 4 - 5
include/kernel/mm.hpp

@@ -123,15 +123,14 @@ public:
     paccess(paccess&&) = delete;
     paccess& operator=(paccess&&) = delete;
 
-    constexpr explicit paccess(page_t pg, bool cached = true)
+    inline explicit paccess(page_t pg, bool cached = true)
         : m_pg(pg)
     {
         m_ptr = pmap(pg, cached);
     }
-    constexpr void* ptr(void) const
-    {
-        return m_ptr;
-    }
+
+    constexpr void* ptr(void) const { return m_ptr; }
+
     ~paccess()
     {
         pfree(m_pg);

+ 8 - 9
include/types/bitmap.hpp

@@ -11,25 +11,24 @@ public:
 
 private:
     deleter_type m_del;
-    unsigned char* m_bm;
     std::size_t m_size;
+    unsigned char* m_bm;
 
     static constexpr std::size_t SZ = sizeof(unsigned char) * 8;
 
 public:
     constexpr bitmap(const deleter_type& del, unsigned char* bm, std::size_t size)
-        : m_del(del), m_bm(bm), m_size(size) {}
+        : m_del(del), m_size(size), m_bm(bm) {}
     constexpr bitmap(deleter_type&& del, unsigned char* bm, std::size_t size)
-        : m_del(std::move(del)), m_bm(bm), m_size(size) {}
+        : m_del(std::move(del)), m_size(size), m_bm(bm) {}
 
     explicit constexpr bitmap(std::size_t size)
-    {
-        m_size = (size / SZ) + ((size % SZ) ? 1 : 0);
-        m_bm = new unsigned char[m_size] {};
-        m_del = [](unsigned char* bm, std::size_t) {
+        : m_del { [](unsigned char* bm, std::size_t) {
             delete[] bm;
-        };
-    }
+        } }
+        , m_size { (size / SZ) + ((size % SZ) ? 1 : 0) }
+        , m_bm { new unsigned char[m_size] {} }
+    { }
 
     bitmap(const bitmap&) = delete;