You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

141 lines
2.5 KiB

#ifndef __FRAME_H__
#define __FRAME_H__
struct frame {
float l;
float r;
inline frame operator+(const frame& rhs) {
return {
.l = l + rhs.l,
.r = r + rhs.r
};
}
inline frame operator+(float rhs) {
return {
.l = l + rhs,
.r = r + rhs
};
}
inline frame operator-(const frame& rhs) {
return {
.l = l - rhs.l,
.r = r - rhs.r
};
}
inline frame operator-(float rhs) {
return {
.l = l - rhs,
.r = r - rhs
};
}
inline frame operator*(const frame& rhs) {
return {
.l = l * rhs.l,
.r = r * rhs.r
};
}
inline frame operator*(float rhs) {
return {
.l = l * rhs,
.r = r * rhs
};
}
inline frame operator/(const frame& rhs) {
return {
.l = l / rhs.l,
.r = r / rhs.r
};
}
inline frame operator/(float rhs) {
return {
.l = l / rhs,
.r = r / rhs
};
}
inline frame operator+=(const frame& rhs) {
this->l += rhs.l;
this->r += rhs.r;
return *this;
}
inline frame operator+=(float rhs) {
this->l += rhs;
this->r += rhs;
return *this;
}
inline frame operator-=(const frame& rhs) {
this->l -= rhs.l;
this->r -= rhs.r;
return *this;
}
inline frame operator-=(float rhs) {
this->l -= rhs;
this->r -= rhs;
return *this;
}
inline frame operator*=(const frame& rhs) {
this->l *= rhs.l;
this->r *= rhs.r;
return *this;
}
inline frame operator*=(float rhs) {
this->l *= rhs;
this->r *= rhs;
return *this;
}
inline frame operator/=(const frame& rhs) {
this->l /= rhs.l;
this->r /= rhs.r;
return *this;
}
inline frame operator/=(float rhs) {
this->l /= rhs;
this->r /= rhs;
return *this;
}
};
inline frame operator+(float lhs, const frame& rhs) {
return {
lhs + rhs.l,
lhs + rhs.r
};
}
inline frame operator-(float lhs, const frame& rhs) {
return {
lhs + rhs.l,
lhs + rhs.r
};
}
inline frame operator*(float lhs, const frame& rhs) {
return {
lhs * rhs.l,
lhs * rhs.r
};
}
inline frame operator/(float lhs, const frame& rhs) {
return {
lhs / rhs.l,
lhs / rhs.r
};
}
#endif