OLD | NEW |
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 // Testing library for testing the foreign function interface. | 5 // Testing library for testing the foreign function interface. |
6 // There are no tests in this file, but we keep this to have a single place | 6 // There are no tests in this file, but we keep this to have a single place |
7 // for functionality that we want to test in the FFI implementation. | 7 // for functionality that we want to test in the FFI implementation. |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 int bufferWrite(char* buffer, int value) { | 350 int bufferWrite(char* buffer, int value) { |
351 uint32_t* size_pointer = (uint32_t*)(buffer + kSizeIndex); | 351 uint32_t* size_pointer = (uint32_t*)(buffer + kSizeIndex); |
352 uint32_t size = *size_pointer; | 352 uint32_t size = *size_pointer; |
353 int* head_pointer = (int*)buffer; | 353 int* head_pointer = (int*)buffer; |
354 int head = *head_pointer; | 354 int head = *head_pointer; |
355 char* value_pointer = buffer + kDataIndex + head; | 355 char* value_pointer = buffer + kDataIndex + head; |
356 *value_pointer = value; | 356 *value_pointer = value; |
357 *head_pointer = (head + 1) % size; | 357 *head_pointer = (head + 1) % size; |
358 return value; | 358 return value; |
359 } | 359 } |
OLD | NEW |