[base] Move math_utils to namespace base

This commit is contained in:
Ming-Hung Tsai
2020-06-15 13:59:16 +08:00
parent 12d7178199
commit 5260a87c0b
8 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@
#ifndef ARRAY_H
#define ARRAY_H
#include "persistent-data/math_utils.h"
#include "base/math_utils.h"
#include "persistent-data/data-structures/btree.h"
#include "persistent-data/data-structures/btree_counter.h"
#include "persistent-data/data-structures/btree_damage_visitor.h"

View File

@ -1,6 +1,6 @@
#include "persistent-data/data-structures/array.h"
#include "persistent-data/data-structures/bitset.h"
#include "persistent-data/math_utils.h"
#include "base/math_utils.h"
using namespace persistent_data;
using namespace persistent_data::bitset_detail;

View File

@ -1,4 +1,4 @@
#include "persistent-data/math_utils.h"
#include "base/math_utils.h"
#include "persistent-data/file_utils.h"
#include "persistent-data/space-maps/core.h"

View File

@ -1,41 +0,0 @@
// Copyright (C) 2011 Red Hat, Inc. All rights reserved.
//
// This file is part of the thin-provisioning-tools source.
//
// thin-provisioning-tools is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// thin-provisioning-tools is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.
#ifndef THINP_MATH_H
#define THINP_MATH_H
//----------------------------------------------------------------
namespace base {
// Only works for integral types
template <typename T>
T div_up(T const &v, T const &divisor) {
return (v + (divisor - 1)) / divisor;
}
// Seemingly pointless function, but it coerces the arguments
// nicely.
template <typename T>
T div_down(T const &v, T const &divisor) {
return v / divisor;
}
}
//----------------------------------------------------------------
#endif

View File

@ -17,7 +17,7 @@
// <http://www.gnu.org/licenses/>.
#include "persistent-data/space-maps/core.h"
#include "persistent-data/math_utils.h"
#include "base/math_utils.h"
#include <stdexcept>

View File

@ -26,7 +26,7 @@
#include "persistent-data/data-structures/btree_damage_visitor.h"
#include "persistent-data/data-structures/btree_counter.h"
#include "persistent-data/checksum.h"
#include "persistent-data/math_utils.h"
#include "base/math_utils.h"
#include "persistent-data/transaction_manager.h"
using namespace persistent_data;