---
milena/ChangeLog | 4 ++++
milena/mln/world/kn/safe_cast.hh | 12 +++++++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index af00618..5b58c66 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2012-10-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * mln/world/kn/safe_cast.hh: Add more conversions.
+
+2012-10-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add immerse_with_border.
* mln/world/k1/immerse_with_inner_border.hh,
diff --git a/milena/mln/world/kn/safe_cast.hh b/milena/mln/world/kn/safe_cast.hh
index e21bdc7..31fe3cd 100644
--- a/milena/mln/world/kn/safe_cast.hh
+++ b/milena/mln/world/kn/safe_cast.hh
@@ -88,7 +88,9 @@ namespace mln
template <unsigned n>
void safe_cast_(const interval<intsub<n> >& from, value::int_u8&
to)
{
- to = intsub<n>(from.to_interop());
+ if (!from.is_degenerated())
+ abort();
+ to = intsub<n>(from.first());
}
template <unsigned n>
@@ -100,6 +102,14 @@ namespace mln
}
template <unsigned n>
+ void safe_cast_(const interval<intsub<n> >& from,
intsub<n>& to)
+ {
+ if (!from.is_degenerated())
+ abort();
+ to = from.first();
+ }
+
+ template <unsigned n>
void safe_cast_(const int& from, interval<intsub<n> >& to)
{
to = interval<intsub<n> >(from);
--
1.7.2.5
Show replies by date