Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
BadAlignmentException.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* BadAlignmentException.cc (C) 2000-2016 */
9/* */
10/* Exception lorsqu'une adresse n'est pas correctement alignée. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/String.h"
17#include "arcane/utils/BadAlignmentException.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22ARCANE_BEGIN_NAMESPACE
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30BadAlignmentException::
31BadAlignmentException(const String& awhere,const void* ptr,Integer alignment)
32: Exception("BadAlignmentException",awhere)
33, m_ptr(ptr)
34, m_wanted_alignment(alignment)
35{
36}
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41BadAlignmentException::
42BadAlignmentException(const TraceInfo& awhere,const void* ptr,Integer alignment)
43: Exception("BadAlignmentException",awhere)
44, m_ptr(ptr)
45, m_wanted_alignment(alignment)
46{
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52void BadAlignmentException::
53explain(std::ostream& m) const
54{
55 Int64 alignment = 0;
56 if (m_wanted_alignment>0){
57 Int64 ptr = (Int64)m_ptr;
58 alignment = ptr % m_wanted_alignment;
59 }
60 m << "Bad alignment for address " << m_ptr
61 << " alignment=" << alignment
62 << " (wanted=" << m_wanted_alignment << ").";
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68ARCANE_END_NAMESPACE
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120