RWalib C Array Library User Guide > Logical Operations > alibNot
  

alibNot
Applies the ~ operator element-wise to scalar or array argument. The PV-WAVE API for this routine is the operator NOT.
Prototypes
void alibNotb( wvlong n, UCHAR *p, UCHAR *r )
void alibNots( wvlong n, short *p, short *r )
void alibNoti( wvlong n, int *p, int *r )
void alibNotl( wvlong n, wvlong *p, wvlong *r )
Parameters
n — (Input) The number of elements in the source array.
*p — (Input) The n-element source array.
*r — (Input/Output) The n-element destination array. On return, r[i] = ~p[i]. This operation can be done in-place (r can equal p).
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
   /* make up some input data for the examples */
   UCHAR b0[9] = {0,1,2,3,4,5,6,7,8};
   /* make an output array */
   UCHAR *b;
   b = (UCHAR*)malloc(9*sizeof(UCHAR));
   printf( "\n\n show the input array b0" );
      alibPrintArrayb( 1, 1, 1, 9, b0, NULL );
   printf( "\n\n put the 'bitwise not' of array b0 into array b" );
      alibinit( NULL, NULL, NULL, NULL );
      alibNotb( 9, b0, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
   printf( "\n\n now do the same operation in-place on b0" );
      alibNotb( 9, b0, b0 );
      alibPrintArrayb( 1, 1, 1, 9, b0, NULL );
}
 
Output:
 
 show the input array b0
 
   0   1   2   3   4   5   6   7   8
 
 put the 'bitwise not' of array b0 into array b
 
 255 254 253 252 251 250 249 248 247
 
 now do the same operation in-place on b0
 
 255 254 253 252 251 250 249 248 247

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.