21 lines
316 B
Plaintext
21 lines
316 B
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
int tint_unary_minus(const int v) {
|
|
return select(-v, v, v == -2147483648);
|
|
}
|
|
|
|
int4 tint_unary_minus_1(const int4 v) {
|
|
return select(-v, v, v == -2147483648);
|
|
}
|
|
|
|
int i(int x) {
|
|
return tint_unary_minus(x);
|
|
}
|
|
|
|
int4 vi(int4 x) {
|
|
return tint_unary_minus_1(x);
|
|
}
|
|
|