shithub: aubio

Download patch

ref: efaeaf17c74bb4d4a28f92826a03fbc40e80efd5
parent: 2510248607060ad6a30fb593c1db4a9e1b79f421
author: Paul Brossier <piem@piem.org>
date: Thu Dec 20 14:06:51 EST 2018

[io] use memset in padding helpers

--- a/src/io/ioutils.c
+++ b/src/io/ioutils.c
@@ -95,11 +95,9 @@
 void
 aubio_source_pad_output (fvec_t *read_data, uint_t source_read)
 {
-  uint_t i = 0;
   if (source_read < read_data->length) {
-    for (i = source_read; i < read_data->length; i++) {
-      read_data->data[i] = 0.;
-    }
+    AUBIO_MEMSET(read_data->data + source_read, 0, read_data->length -
+        source_read);
   }
 }
 
@@ -106,12 +104,11 @@
 void
 aubio_source_pad_multi_output (fmat_t *read_data,
     uint_t source_channels, uint_t source_read) {
-  uint_t i, j;
+  uint_t i;
   if (source_read < read_data->length) {
     for (i = 0; i < read_data->height; i++) {
-      for (j = source_read; j < read_data->length; j++) {
-        read_data->data[i][j] = 0.;
-      }
+      AUBIO_MEMSET(read_data->data[i] + source_read, 0,
+          read_data->length - source_read);
     }
   }
 }