/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SOFTRVV_VMFGT_H
#define SOFTRVV_VMFGT_H

#include <stddef.h>

namespace softrvv {

// The type of dest is defined as int32_t instead of float
// to use "set_bit_in_dest_mask", which has bitwise operations in it.
void vmfgt_vf(int32_t *dest, float *src2, const float *src1, int32_t avl) {
  for (int32_t idx = 0; idx < avl; idx++) {
    set_bit_in_dest_mask<int32_t>(idx, dest, src2[idx] > *src1);
  }
}

// The type of dest is defined as int32_t instead of float
// to use "set_bit_in_dest_mask", which has bitwise operations in it.
void vmfgt_vv(int32_t *dest, float *src2, float *src1, int32_t avl) {
  for (int32_t idx = 0; idx < avl; idx++) {
    set_bit_in_dest_mask<int32_t>(idx, dest, src2[idx] > src1[idx]);
  }
}

}  // namespace softrvv

#endif  // SOFTRVV_VMFGT_H
