/* * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) * * SPDX-License-Identifier: BSD-2-Clause */ /** FNSPEC swap_spec: "\x y. \ \ \\. (\p \ x \\<^sup>* \q \ y)\<^bsup>sep\<^esup> \ PROC swap(\p,\q) \ (\<^bsup>\\<^esup>p \ y \\<^sup>* \<^bsup>\\<^esup>q \ x)\<^bsup>sep\<^esup> \" */ void swap(unsigned int *p, unsigned int *q) { unsigned int x; x = *p; *p = *q; *q = x; } /** FNSPEC test_spec: "\x y. \ \ \\. (\a \ x \\<^sup>* \b \ y \\<^sup>* \c \ -)\<^bsup>sep\<^esup> \ PROC test(\a,\b,\c) \ (\<^bsup>\\<^esup>a \ (x + y) \\<^sup>* \<^bsup>\\<^esup>b \ x \\<^sup>* \<^bsup>\\<^esup>c \ y)\<^bsup>sep\<^esup> \" */ void test(unsigned int *a, unsigned int *b, unsigned int *c) { *c = *a + *b; swap(a,b); swap(c,a); }