tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

copy_set_operations.c (2038B)


      1 /*
      2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 /*
     12 * This file contains the implementation of functions
     13 * WebRtcSpl_MemSetW16()
     14 * WebRtcSpl_MemSetW32()
     15 * WebRtcSpl_MemCpyReversedOrder()
     16 * WebRtcSpl_CopyFromEndW16()
     17 * WebRtcSpl_ZerosArrayW16()
     18 * WebRtcSpl_ZerosArrayW32()
     19 *
     20 * The description header can be found in signal_processing_library.h
     21 *
     22 */
     23 
     24 #include <string.h>
     25 
     26 #include "common_audio/signal_processing/include/signal_processing_library.h"
     27 
     28 void WebRtcSpl_MemSetW16(int16_t* ptr, int16_t set_value, size_t length) {
     29  size_t j;
     30  int16_t* arrptr = ptr;
     31 
     32  for (j = length; j > 0; j--) {
     33    *arrptr++ = set_value;
     34  }
     35 }
     36 
     37 void WebRtcSpl_MemSetW32(int32_t* ptr, int32_t set_value, size_t length) {
     38  size_t j;
     39  int32_t* arrptr = ptr;
     40 
     41  for (j = length; j > 0; j--) {
     42    *arrptr++ = set_value;
     43  }
     44 }
     45 
     46 void WebRtcSpl_MemCpyReversedOrder(int16_t* dest,
     47                                   int16_t* source,
     48                                   size_t length) {
     49  size_t j;
     50  int16_t* destPtr = dest;
     51  int16_t* sourcePtr = source;
     52 
     53  for (j = 0; j < length; j++) {
     54    *destPtr-- = *sourcePtr++;
     55  }
     56 }
     57 
     58 void WebRtcSpl_CopyFromEndW16(const int16_t* vector_in,
     59                              size_t length,
     60                              size_t samples,
     61                              int16_t* vector_out) {
     62  // Copy the last <samples> of the input vector to vector_out
     63  WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[length - samples], samples);
     64 }
     65 
     66 void WebRtcSpl_ZerosArrayW16(int16_t* vector, size_t length) {
     67  WebRtcSpl_MemSetW16(vector, 0, length);
     68 }
     69 
     70 void WebRtcSpl_ZerosArrayW32(int32_t* vector, size_t length) {
     71  WebRtcSpl_MemSetW32(vector, 0, length);
     72 }