Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olena
olena
Commits
38f31bc0
Commit
38f31bc0
authored
Nov 15, 2010
by
Guillaume Lazzara
Browse files
Add conversions from int_u to float and double.
* mln/convert/from_to.hxx, * mln/value/int_u.hh: Here.
parent
85d4bb72
Changes
3
Hide whitespace changes
Inline
Side-by-side
milena/ChangeLog
View file @
38f31bc0
2010-11-15 Guillaume Lazzara <z@lrde.epita.fr>
Add conversions from int_u to float and double.
* mln/convert/from_to.hxx,
* mln/value/int_u.hh: Here.
2010-11-15 Guillaume Lazzara <z@lrde.epita.fr>
* mln/convert/from_to.hh: Make use of value::cast for conversions
milena/mln/convert/from_to.hxx
View file @
38f31bc0
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
...
...
@@ -202,6 +203,14 @@ namespace mln
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
bool
&
to_
);
// int_u -> float
template
<
unsigned
n
>
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
float
&
to_
);
// int_u -> double
template
<
unsigned
n
>
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
double
&
to_
);
// label -> int_u.
template
<
unsigned
n
>
void
...
...
milena/mln/value/int_u.hh
View file @
38f31bc0
...
...
@@ -128,6 +128,18 @@ namespace mln
from_to_
(
const
value
::
int_u
<
n
>&
from
,
bool
&
to_
);
// int_u -> float.
template
<
unsigned
n
>
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
float
&
to_
);
// int_u -> double.
template
<
unsigned
n
>
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
double
&
to_
);
}
// end of namespace mln::convert::over_load
}
// end of namespace mln::convert
...
...
@@ -232,6 +244,24 @@ namespace mln
to_
=
(
from
!=
0u
);
}
// int_u -> float.
template
<
unsigned
n
>
inline
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
float
&
to_
)
{
to_
=
static_cast
<
float
>
(
from
);
}
// int_u -> double.
template
<
unsigned
n
>
inline
void
from_to_
(
const
value
::
int_u
<
n
>&
from
,
double
&
to_
)
{
to_
=
static_cast
<
double
>
(
from
);
}
}
// end of namespace mln::convert::over_load
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment