rror (Core Functions)


Import

#include <archr/core/rror.h>
#include <archr/core/rror.hpp>
import archr.core
atomsLoads('archr')

Synopsis

 int8_t archr_core_rror_1i8i8(const int8_t i1, const int8_t i2);
(1)
 uint8_t archr_core_rror_1u8i8(const uint8_t i1, const int8_t i2);
(2)
 int16_t archr_core_rror_1i16i16(const int16_t i1, const int16_t i2);
(3)
 uint16_t archr_core_rror_1u16i16(const uint16_t i1, const int16_t i2);
(4)
 float archr_core_rror_1f32i32(const float i1, const int32_t i2);
(5)
 int32_t archr_core_rror_1i32i32(const int32_t i1, const int32_t i2);
(6)
 uint32_t archr_core_rror_1u32i32(const uint32_t i1, const int32_t i2);
(7)
 double archr_core_rror_1f64i64(const double i1, const int64_t i2);
(8)
 int64_t archr_core_rror_1i64i64(const int64_t i1, const int64_t i2);
(9)
 uint64_t archr_core_rror_1u64i64(const uint64_t i1, const int64_t i2);
(10)
 int8_t archr_core_rror_1i8u8(const int8_t i1, const uint8_t i2);
(11)
 uint8_t archr_core_rror_1u8u8(const uint8_t i1, const uint8_t i2);
(12)
 int16_t archr_core_rror_1i16u16(const int16_t i1, const uint16_t i2);
(13)
 uint16_t archr_core_rror_1u16u16(const uint16_t i1, const uint16_t i2);
(14)
 float archr_core_rror_1f32u32(const float i1, const uint32_t i2);
(15)
 int32_t archr_core_rror_1i32u32(const int32_t i1, const uint32_t i2);
(16)
 uint32_t archr_core_rror_1u32u32(const uint32_t i1, const uint32_t i2);
(17)
 double archr_core_rror_1f64u64(const double i1, const uint64_t i2);
(18)
 int64_t archr_core_rror_1i64u64(const int64_t i1, const uint64_t i2);
(19)
 uint64_t archr_core_rror_1u64u64(const uint64_t i1, const uint64_t i2);
(20)
 void archr_core_rror_i8i8(int8_t *o0, const int8_t *i1, size_t sz, const int8_t *i2);
(21)
 void archr_core_rror_u8i8(uint8_t *o0, const uint8_t *i1, size_t sz, const int8_t *i2);
(22)
 void archr_core_rror_i16i16(int16_t *o0, const int16_t *i1, size_t sz, const int16_t *i2);
(23)
 void archr_core_rror_u16i16(uint16_t *o0, const uint16_t *i1, size_t sz, const int16_t *i2);
(24)
 void archr_core_rror_f32i32(float *o0, const float *i1, size_t sz, const int32_t *i2);
(25)
 void archr_core_rror_i32i32(int32_t *o0, const int32_t *i1, size_t sz, const int32_t *i2);
(26)
 void archr_core_rror_u32i32(uint32_t *o0, const uint32_t *i1, size_t sz, const int32_t *i2);
(27)
 void archr_core_rror_f64i64(double *o0, const double *i1, size_t sz, const int64_t *i2);
(28)
 void archr_core_rror_i64i64(int64_t *o0, const int64_t *i1, size_t sz, const int64_t *i2);
(29)
 void archr_core_rror_u64i64(uint64_t *o0, const uint64_t *i1, size_t sz, const int64_t *i2);
(30)
 void archr_core_rror_i8u8(int8_t *o0, const int8_t *i1, size_t sz, const uint8_t *i2);
(31)
 void archr_core_rror_u8u8(uint8_t *o0, const uint8_t *i1, size_t sz, const uint8_t *i2);
(32)
 void archr_core_rror_i16u16(int16_t *o0, const int16_t *i1, size_t sz, const uint16_t *i2);
(33)
 void archr_core_rror_u16u16(uint16_t *o0, const uint16_t *i1, size_t sz, const uint16_t *i2);
(34)
 void archr_core_rror_f32u32(float *o0, const float *i1, size_t sz, const uint32_t *i2);
(35)
 void archr_core_rror_i32u32(int32_t *o0, const int32_t *i1, size_t sz, const uint32_t *i2);
(36)
 void archr_core_rror_u32u32(uint32_t *o0, const uint32_t *i1, size_t sz, const uint32_t *i2);
(37)
 void archr_core_rror_f64u64(double *o0, const double *i1, size_t sz, const uint64_t *i2);
(38)
 void archr_core_rror_i64u64(int64_t *o0, const int64_t *i1, size_t sz, const uint64_t *i2);
(39)
 void archr_core_rror_u64u64(uint64_t *o0, const uint64_t *i1, size_t sz, const uint64_t *i2);
(40)
 int8_t rror(const int8_t i1, const int8_t i2);
(1)
 uint8_t rror(const uint8_t i1, const int8_t i2);
(2)
 int16_t rror(const int16_t i1, const int16_t i2);
(3)
 uint16_t rror(const uint16_t i1, const int16_t i2);
(4)
 float rror(const float i1, const int32_t i2);
(5)
 int32_t rror(const int32_t i1, const int32_t i2);
(6)
 uint32_t rror(const uint32_t i1, const int32_t i2);
(7)
 double rror(const double i1, const int64_t i2);
(8)
 int64_t rror(const int64_t i1, const int64_t i2);
(9)
 uint64_t rror(const uint64_t i1, const int64_t i2);
(10)
 int8_t rror(const int8_t i1, const uint8_t i2);
(11)
 uint8_t rror(const uint8_t i1, const uint8_t i2);
(12)
 int16_t rror(const int16_t i1, const uint16_t i2);
(13)
 uint16_t rror(const uint16_t i1, const uint16_t i2);
(14)
 float rror(const float i1, const uint32_t i2);
(15)
 int32_t rror(const int32_t i1, const uint32_t i2);
(16)
 uint32_t rror(const uint32_t i1, const uint32_t i2);
(17)
 double rror(const double i1, const uint64_t i2);
(18)
 int64_t rror(const int64_t i1, const uint64_t i2);
(19)
 uint64_t rror(const uint64_t i1, const uint64_t i2);
(20)
 void rror(const int8_t *i1, size_t sz, const int8_t *i2, int8_t *o0);
(21)
 void rror(const uint8_t *i1, size_t sz, const int8_t *i2, uint8_t *o0);
(22)
 void rror(const int16_t *i1, size_t sz, const int16_t *i2, int16_t *o0);
(23)
 void rror(const uint16_t *i1, size_t sz, const int16_t *i2, uint16_t *o0);
(24)
 void rror(const float *i1, size_t sz, const int32_t *i2, float *o0);
(25)
 void rror(const int32_t *i1, size_t sz, const int32_t *i2, int32_t *o0);
(26)
 void rror(const uint32_t *i1, size_t sz, const int32_t *i2, uint32_t *o0);
(27)
 void rror(const double *i1, size_t sz, const int64_t *i2, double *o0);
(28)
 void rror(const int64_t *i1, size_t sz, const int64_t *i2, int64_t *o0);
(29)
 void rror(const uint64_t *i1, size_t sz, const int64_t *i2, uint64_t *o0);
(30)
 void rror(const int8_t *i1, size_t sz, const uint8_t *i2, int8_t *o0);
(31)
 void rror(const uint8_t *i1, size_t sz, const uint8_t *i2, uint8_t *o0);
(32)
 void rror(const int16_t *i1, size_t sz, const uint16_t *i2, int16_t *o0);
(33)
 void rror(const uint16_t *i1, size_t sz, const uint16_t *i2, uint16_t *o0);
(34)
 void rror(const float *i1, size_t sz, const uint32_t *i2, float *o0);
(35)
 void rror(const int32_t *i1, size_t sz, const uint32_t *i2, int32_t *o0);
(36)
 void rror(const uint32_t *i1, size_t sz, const uint32_t *i2, uint32_t *o0);
(37)
 void rror(const double *i1, size_t sz, const uint64_t *i2, double *o0);
(38)
 void rror(const int64_t *i1, size_t sz, const uint64_t *i2, int64_t *o0);
(39)
 void rror(const uint64_t *i1, size_t sz, const uint64_t *i2, uint64_t *o0);
(40)
subroutine archr_core_rror_1i8i8(integer(1) :: r, integer(1), parameter :: i1, integer(1), parameter :: i2)
(1)
subroutine archr_core_rror_1u8i8(integer(1) :: r, integer(1), parameter :: i1, integer(1), parameter :: i2)
(2)
subroutine archr_core_rror_1i16i16(integer(2) :: r, integer(2), parameter :: i1, integer(2), parameter :: i2)
(3)
subroutine archr_core_rror_1u16i16(integer(2) :: r, integer(2), parameter :: i1, integer(2), parameter :: i2)
(4)
subroutine archr_core_rror_1f32i32(real(4) :: r, real(4), parameter :: i1, integer(4), parameter :: i2)
(5)
subroutine archr_core_rror_1i32i32(integer(4) :: r, integer(4), parameter :: i1, integer(4), parameter :: i2)
(6)
subroutine archr_core_rror_1u32i32(integer(4) :: r, integer(4), parameter :: i1, integer(4), parameter :: i2)
(7)
subroutine archr_core_rror_1f64i64(real(8) :: r, real(8), parameter :: i1, integer(8), parameter :: i2)
(8)
subroutine archr_core_rror_1i64i64(integer(8) :: r, integer(8), parameter :: i1, integer(8), parameter :: i2)
(9)
subroutine archr_core_rror_1u64i64(integer(8) :: r, integer(8), parameter :: i1, integer(8), parameter :: i2)
(10)
subroutine archr_core_rror_1i8u8(integer(1) :: r, integer(1), parameter :: i1, integer(1), parameter :: i2)
(11)
subroutine archr_core_rror_1u8u8(integer(1) :: r, integer(1), parameter :: i1, integer(1), parameter :: i2)
(12)
subroutine archr_core_rror_1i16u16(integer(2) :: r, integer(2), parameter :: i1, integer(2), parameter :: i2)
(13)
subroutine archr_core_rror_1u16u16(integer(2) :: r, integer(2), parameter :: i1, integer(2), parameter :: i2)
(14)
subroutine archr_core_rror_1f32u32(real(4) :: r, real(4), parameter :: i1, integer(4), parameter :: i2)
(15)
subroutine archr_core_rror_1i32u32(integer(4) :: r, integer(4), parameter :: i1, integer(4), parameter :: i2)
(16)
subroutine archr_core_rror_1u32u32(integer(4) :: r, integer(4), parameter :: i1, integer(4), parameter :: i2)
(17)
subroutine archr_core_rror_1f64u64(real(8) :: r, real(8), parameter :: i1, integer(8), parameter :: i2)
(18)
subroutine archr_core_rror_1i64u64(integer(8) :: r, integer(8), parameter :: i1, integer(8), parameter :: i2)
(19)
subroutine archr_core_rror_1u64u64(integer(8) :: r, integer(8), parameter :: i1, integer(8), parameter :: i2)
(20)
subroutine archr_core_rror_f32i32(real(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, real(4), dimension(*) :: o0)
(21)
subroutine archr_core_rror_i32i32(integer(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, integer(4), dimension(*) :: o0)
(22)
subroutine archr_core_rror_u32i32(integer(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, integer(4), dimension(*) :: o0)
(23)
subroutine archr_core_rror_f32u32(real(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, real(4), dimension(*) :: o0)
(24)
subroutine archr_core_rror_i32u32(integer(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, integer(4), dimension(*) :: o0)
(25)
subroutine archr_core_rror_u32u32(integer(4), dimension(*), parameter :: i1, integer(4) :: sz, integer(4), dimension(*), parameter :: i2, integer(4), dimension(*) :: o0)
(26)
def rror(i1, i2):
    return o0
(1)
function o0 = archr_core_rror(i1, i2)
(1)

Description

Computes the rror:

Parameters

i1_first, i1_last

The first range of input elements

i2

The beggining of the the second range of input elements

o0

The beginning of the destination range, may be equal to i1 or i2

i1, i2

The scalar/contiguous data input elements

Example


#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <archr/core/rror.h>

double rand_in(double min, double max) {
  return min + ((double)(max - min) * ((double)rand() / RAND_MAX));
}

int main() {
  time_t t;
  size_t i;
  size_t sz = 10;
  int32_t* i1 = (int32_t*)malloc(sz * sizeof(int32_t));
  int32_t* i2 = (int32_t*)malloc(sz * sizeof(int32_t));
  int32_t* o1 = (int32_t*)malloc(sz * sizeof(int32_t));

  srand((unsigned int)time(&t));
  for (i = 0; i < sz; ++i) {
    i1[i] = (int32_t)rand_in((int32_t)-10, (int32_t)10);
  i2[i] = (int32_t)rand_in((int32_t)-10, (int32_t)10);
  }
  archr_core_rror_i32i32(o1, i1, sz, i2);
  for (i = 0; i < sz; ++i) {
    printf("%4lu: rror(%d, %d) = %d\n", i, i1[i], i2[i], o1[i]);
  }
}

Possible Output

   0: rror(-7, -6) = -385
   1: rror(-9, 5) = -1073741825
   2: rror(6, 7) = 201326592
   3: rror(-2, -6) = -65
   4: rror(8, -5) = 256
   5: rror(0, 0) = 0
   6: rror(-6, 0) = -6
   7: rror(-2, -9) = -513
   8: rror(-6, 4) = -1342177281
   9: rror(4, 6) = 268435456

#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <archr/core/rror.hpp>

double rand_in(double min, double max) {
  return min + (double(max - min) * (double(std::rand()) / RAND_MAX));
}

int main() {
  std::size_t i;
  std::size_t sz = 10;
  std::vector<std::int32_t> i1(sz);
  std::vector<std::int32_t> i2(sz);
  std::vector<std::int32_t> o1(sz);

  std::srand(std::time(0));
  std::generate(i1.begin(), i1.end(), []() { return rand_in(std::int32_t(-10), std::int32_t(10)); });
  std::generate(i2.begin(), i2.end(), []() { return rand_in(std::int32_t(-10), std::int32_t(10)); });
  archr::core::rror(i1.data(), sz, i2.data(), o1.data());
  for (i = 0; i < sz; ++i) {
    std::cout << std::setw(4) << i << ": " << "rror" << "(" << i1[i] << ", " << i2[i] << ")" << " = " << o1[i] << std::endl;
  }
}

Possible Output

   0: rror(9, 0) = 9
   1: rror(1, -6) = 64
   2: rror(-3, 1) = -2
   3: rror(-7, 0) = -7
   4: rror(-5, -2) = -17
   5: rror(-8, -9) = -3585
   6: rror(4, -3) = 32
   7: rror(9, -9) = 4608
   8: rror(5, 8) = 83886080
   9: rror(6, 9) = 50331648

program main
  integer(4), parameter  :: sz = 10
  integer(4), dimension(sz) :: o0
  integer(4), dimension(sz) :: i0
  integer(4), dimension(sz) :: i1
  real(8)                :: r0, r1
  real(8)                :: min0, max0
  real(8)                :: min1, max1
  real(8)                :: min2, max2
  ! Init:
    min0 = -10
    max0 = 10
    min1 = -10
    max1 = 10
  do i=1,sz
    r0 = random_in(min0, max0)
    r1 = random_in(min1, max1)
    i0(i) = int(r0)
    i1(i) = int(r1)
  end do
  ! Example:
  call archr_core_rror_i32i32(o0, i0, size(i0), i1)
  ! Output:
  do i=1,sz
    print *, i, ": ", o0(i)
  end do
contains
  ! Generate a random number within a range
  function random_in(mn, mx) result(r)
    real(8) :: r
    real(8), intent(in) :: mn, mx
    r = mn + (rand() * (mx - mn))
  end function random_in
end program

Possible Output

           1 :        -1025
           2 :            5
           3 :            0
           4 :           -2
           5 :     50331648
           6 :           -2
           7 :         3072
           8 :           -8
           9 :         1536
          10 :         -257