codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

Refactor `GAT0` and friends #83

Open codereport opened 3 years ago

codereport commented 3 years ago

In jsrc/verbs/monadic/tally.cpp:

[[nodiscard]] auto
make_scalar_integer(J jt, int64_t k) -> array {
    if (xor_replicate_sign(k) <= NUMMAX) {
        return !zero_or_one(k) ? refactorme_num(k) : zeroionei(k);
    }
    array z;
    GAT0(z, INT, 1, 0);          // TODO: GA -> make_array refactoring
    pointer_to_ravel(z)[0] = k;  // TODO: set_value(..)
    return z;
}