Skip to content

Commit

Permalink
Speculative fix for #7489
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 698627551
  • Loading branch information
dsharletg authored and xnnpack-bot committed Nov 21, 2024
1 parent e297edd commit 61ac1d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/reference/unary-elementwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ struct ConvertOp {
TOut operator()(TIn x) const {
if (std::is_integral<TOut>::value && !std::is_integral<TIn>::value) {
return round_float_to_int<TOut>(x);
} else {
} else if (std::is_integral<TOut>::value && std::is_integral<TIn>::value) {
return static_cast<TOut>(x);
} else {
// Cast to intermediate float to work around issue #7489
return static_cast<TOut>(static_cast<float>(x));
}
}
};
Expand Down

0 comments on commit 61ac1d2

Please sign in to comment.