/*
 * 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_INCLUDE_SOFTRVV_VMFEQ_H_
#define SOFTRVV_INCLUDE_SOFTRVV_VMFEQ_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 vmfeq_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 vmfeq_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_INCLUDE_SOFTRVV_VMFEQ_H_
