sPyNNaker neural_modelling  7.4.2
common_mem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef INCLUDED_COMMON_MEM_H
18 #define INCLUDED_COMMON_MEM_H
19 
20 #include <common-typedefs.h>
21 
24 
33 static inline void fast_memcpy(
34  void *restrict to, const void *restrict from, size_t num_bytes) {
35  uint32_t *to_ptr = to;
36  const uint32_t *from_ptr = from;
37  while (num_bytes) {
38  *to_ptr++ = *from_ptr++;
39  num_bytes -= sizeof(uint32_t);
40  }
41 }
42 
43 #endif // INCLUDED_COMMON_MEM_H
static void fast_memcpy(void *restrict to, const void *restrict from, size_t num_bytes)
A small and fast version of memcpy().
Definition: common_mem.h:33