X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4f0b473db654af3da6cc609b6d94b5b6d9652c4c..e6ca184e99d50d0ee8fe405a83ee5277e2ecfce6:/src/mc/mc_mmu.h diff --git a/src/mc/mc_mmu.h b/src/mc/mc_mmu.h index 71870e7487..11172088ae 100644 --- a/src/mc/mc_mmu.h +++ b/src/mc/mc_mmu.h @@ -1,15 +1,17 @@ -/* Copyright (c) 2014. The SimGrid Team. +/* Copyright (c) 2014-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef MC_MMU_H -#define MC_MMU_H +#ifndef SIMGRID_MC_MMU_H +#define SIMGRID_MC_MMU_H -#include -#include +#include +#include +#include +#include // xbt_pagesize... #include #include @@ -25,9 +27,8 @@ static inline __attribute__ ((always_inline)) size_t mc_page_count(size_t size) { size_t page_count = size >> xbt_pagebits; - if (size & (xbt_pagesize-1)) { + if (size & (xbt_pagesize-1)) page_count ++; - } return page_count; } @@ -40,7 +41,7 @@ static inline __attribute__ ((always_inline)) size_t mc_page_number(const void* base, const void* address) { xbt_assert(address>=base, "The address is not in the range"); - return ((uintptr_t) address - (uintptr_t) base) >> xbt_pagebits; + return ((std::uintptr_t) address - (std::uintptr_t) base) >> xbt_pagebits; } /** @brief Get the offset of an address within a memory page @@ -51,7 +52,7 @@ size_t mc_page_number(const void* base, const void* address) static inline __attribute__ ((always_inline)) size_t mc_page_offset(const void* address) { - return ((uintptr_t) address) & (xbt_pagesize-1); + return ((std::uintptr_t) address) & (xbt_pagesize-1); } /** @brief Get the virtual address of a virtual memory page @@ -68,7 +69,8 @@ void* mc_page_from_number(const void* base, size_t page) static inline __attribute__ ((always_inline)) bool mc_same_page(const void* a, const void* b) { - return ((uintptr_t) a >> xbt_pagebits) == ((uintptr_t) b >> xbt_pagebits); + return ((std::uintptr_t) a >> xbt_pagebits) + == ((std::uintptr_t) b >> xbt_pagebits); } SG_END_DECL()