Skip to content

Commit

Permalink
[Trifocal+P2Pt] microopt: memcpy copying precisely the last t only
Browse files Browse the repository at this point in the history
  • Loading branch information
rfabbri committed Nov 13, 2023
1 parent ae33b77 commit 9ea934f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions minus/internal-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ struct minus_array { // Speed critical -----------------------------------------
for (unsigned int i=0; i < N; ++i,++a,++b) *a += *b;
}

static inline __attribute__((always_inline)) void
fadd_to_self(C<F> * __restrict a, const C<F> * __restrict b)
{
for (unsigned int i=0; i < N+1; ++i,++a,++b) *a += *b;
}

static inline __attribute__((always_inline)) void
add_scalar_to_self(C<F> * __restrict a, C<F> b)
{
Expand All @@ -56,6 +62,13 @@ struct minus_array { // Speed critical -----------------------------------------
{
memcpy(b, a, N*sizeof(C<F>));
}

static inline __attribute__((always_inline)) void
fcopy(const C<F> * __restrict a, C<F> * __restrict b)
{
memcpy(b, a, N*sizeof(C<F>)+sizeof(F));
}

static inline __attribute__((always_inline)) F
norm2(const C<F> *__restrict a)
{
Expand Down

0 comments on commit 9ea934f

Please sign in to comment.