#ifndef _CFTTVECTOR32_H_
#define _CFTTVECTOR32_H_

#include "common.h"

class CFTTVector32 {
public:
  CFTTVector32() __attribute__((always_inline))
  {
    float_0 = 0.0f;
    float_4 = 0.0f;
    float_8 = 0.0f;
  }

  CFTTVector32(float f1, float f2, float f3) __attribute__((always_inline))  //自己加的方便调用
  {
    float_0 = f1;
    float_4 = f2;
    float_8 = f3;  
  }

  int operator!=(CFTTVector32 const& vec32) const;
  CFTTVector32* operator*=(float a2);
  CFTTVector32* operator+=(CFTTVector32 const& a2);
  CFTTVector32* operator-=(CFTTVector32 const& a2);
  CFTTVector32* operator/=(float a2);
  int operator==(CFTTVector32 const& a2) const;  // 001BDF38
  inline CFTTVector32* operator=(CFTTVector32 const& other);

  void Flip() {
    float_0 = -float_0;
    float_4 = -float_4;
    float_8 = -float_8;
  }

  void copy(CFTTVector32 a1) {
    float_0 = a1.float_0;
    float_4 = a1.float_4;
    float_8 = a1.float_8;
  }

  void copy(float x, float y, float z) {
    float_0 = x;
    float_4 = y;
    float_8 = z;
  }

  CFTTVector32(CFTTVector32 const& a1, CFTTVector32 const& a2) {
    float fX = (a1.float_8 * a2.float_4) - (a1.float_4 * a2.float_8);
    float fY = (a1.float_0 * a2.float_8) - (a1.float_8 * a2.float_0);
    float fZ = (a1.float_4 * a2.float_0) - (a1.float_0 * a2.float_4);

    float_0 = fX;
    float_4 = fY;
    float_8 = fZ;
  }

  CFTTVector32 operator-(CFTTVector32 const& f2) {
    float fX = float_0 - f2.float_0;
    float fY = float_4 - f2.float_4;
    float fZ = float_8 - f2.float_8;

    CFTTVector32 ftt;
    ftt.float_0 = fX;
    ftt.float_4 = fY;
    ftt.float_8 = fZ;
    return ftt;
  }

  CFTTVector32 operator+(CFTTVector32 const& f2) {
    float fX = float_0 + f2.float_0;
    float fY = float_4 + f2.float_4;
    float fZ = float_8 + f2.float_8;

    CFTTVector32 ftt;
    ftt.float_0 = fX;
    ftt.float_4 = fY;
    ftt.float_8 = fZ;
    return ftt;
  }
  CFTTVector32 operator*(float f2) {
    float fX = float_0 * f2;
    float fY = float_4 * f2;
    float fZ = float_8 * f2;

    CFTTVector32 ftt;
    ftt.float_0 = fX;
    ftt.float_4 = fY;
    ftt.float_8 = fZ;
    return ftt;
  }
  float operator*(CFTTVector32 const& a2) {
    return float_0 * a2.float_0 +
           float_4 * a2.float_4 +
           float_8 * a2.float_8;
  }
  CFTTVector32 operator/(float f2) {
    float fX = float_0 / f2;
    float fY = float_4 / f2;
    float fZ = float_8 / f2;

    CFTTVector32 ftt;
    ftt.float_0 = fX;
    ftt.float_4 = fY;
    ftt.float_8 = fZ;
    return ftt;
  }

  float operator/(CFTTVector32 const& a2) {
    return float_0 / a2.float_0 +
           float_4 / a2.float_4 +
           float_8 / a2.float_8;
  }

  float float_0;
  float float_4;
  float float_8;

  static CFTTVector32 s_vZeroVector;  // 005CDEB4
};

inline CFTTVector32* CFTTVector32::operator=(CFTTVector32 const& other) {
  float_0 = other.float_0;
  float_4 = other.float_4;
  float_8 = other.float_8;
  return this;
}

#endif  //_CFTTVECTOR32_H__