Ignore:
Timestamp:
Dec 31, 2019, 12:19:53 PM (2 years ago)
Author:
Dmitry Kobets <dkobets@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
f8a8fb1
Parents:
94df8de
git-author:
Dmitry Kobets <dkobets@…> (12/31/19 12:13:34)
git-committer:
Dmitry Kobets <dkobets@…> (12/31/19 12:19:53)
Message:

Refactor vector library classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/vec/vec4.hfa

    r94df8de r250dbae  
    1010}
    1111
    12 
    1312forall (otype T) {
    1413    static inline {
     
    3130    }
    3231
    33     // Assignment
    3432    void ?=?(vec4(T)& vec, vec4(T) other) with (vec) {
    3533        [x,y,z,w] = other.[x,y,z,w];
     
    4442    // -
    4543    forall(| subtract(T)) {
    46     vec4(T) ?-?(vec4(T) u, vec4(T) v) { // TODO( can't make this const ref )
     44    vec4(T) ?-?(vec4(T) u, vec4(T) v) {
    4745        return [u.x - v.x, u.y - v.y, u.z - v.z, u.w - v.w];
    4846    }
     
    5250    }
    5351    }
    54 
    5552    forall(| negate(T)) {
    5653    vec4(T) -?(vec4(T) v) with (v) {
     
    5855    }
    5956    }
    60 
    6157    forall(| { T --?(T&); }) {
    6258    vec4(T)& --?(vec4(T)& v) {
     
    10298    // *
    10399    forall(| multiply(T)) {
    104     vec4(T) ?*?(vec4(T) v, T scalar) with (v) { // TODO (can't make this const ref)
     100    vec4(T) ?*?(vec4(T) v, T scalar) with (v) {
    105101        return [x * scalar, y * scalar, z * scalar, w * scalar];
    106102    }
    107     vec4(T) ?*?(T scalar, vec4(T) v) { // TODO (can't make this const ref)
     103    vec4(T) ?*?(T scalar, vec4(T) v) {
    108104        return v * scalar;
    109105    }
     
    121117    }
    122118
    123     // Scalar Division
     119    // /
    124120    forall(| divide(T)) {
    125121    vec4(T) ?/?(vec4(T) v, T scalar) with (v) {
     
    129125        return [u.x / v.x, u.y / v.y, u.z / v.z, u.w / v.w];
    130126    }
    131     vec4(T)& ?/=?(vec4(T)& v, T scalar) with (v) {
     127    vec4(T)& ?/=?(vec4(T)& v, T scalar) {
    132128        v = v / scalar;
    133129        return v;
     
    253249    }
    254250
    255     // Relational Operators
     251    // relational
    256252    forall(| equality(T)) {
    257253    bool ?==?(vec4(T) u, vec4(T) v) with (u) {
Note: See TracChangeset for help on using the changeset viewer.