sum.c 439 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. /*
  6. * have something in bss so that llvm synthesizes
  7. * wasm start function for this module.
  8. */
  9. char *
  10. return_bss()
  11. {
  12. static char bss[4096];
  13. return bss;
  14. }
  15. int
  16. sum(int start, int length)
  17. {
  18. int sum = 0, i;
  19. for (i = start; i < start + length; i++) {
  20. sum += i;
  21. }
  22. return sum;
  23. }