Section 2.5: Operations on 32- and 64-bit Integers.
[guile-r6rs-libs.git] / modules / r6rs / bytevector.scm
blob17577a98189d334059dab50cfa14bf61350fb29a
1 ;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries.
2 ;;; Copyright (C) 2007  Ludovic Courtès <ludovic.courtes@laas.fr>
3 ;;;
4 ;;; Guile-R6RS-Libs is free software; you can redistribute it and/or
5 ;;; modify it under the terms of the GNU Lesser General Public
6 ;;; License as published by the Free Software Foundation; either
7 ;;; version 2.1 of the License, or (at your option) any later version.
8 ;;;
9 ;;; Guile-R6RS-Libs is distributed in the hope that it will be useful,
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 ;;; Lesser General Public License for more details.
13 ;;;
14 ;;; You should have received a copy of the GNU Lesser General Public
15 ;;; License along with Guile-R6RS-Libs; if not, write to the Free Software
16 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 (define-module (r6rs bytevector)
19   :export-syntax (endianness)
20   :export (native-endianness bytevector?
21            make-bytevector bytevector-length bytevector=? bytevector-fill!
22            bytevector-copy! bytevector-copy bytevector-u8-ref
23            bytevector-s8-ref
24            bytevector-u8-set! bytevector-s8-set! bytevector->u8-list
25            u8-list->bytevector
26            bytevector-uint-ref bytevector-uint-set!
27            bytevector-sint-ref bytevector-sint-set!
28            bytevector->sint-list bytevector->uint-list
29            uint-list->bytevector sint-list->bytevector
31            bytevector-u16-ref bytevector-s16-ref
32            bytevector-u16-set! bytevector-s16-set!
33            bytevector-u16-native-ref bytevector-s16-native-ref
34            bytevector-u16-native-set! bytevector-s16-native-set!
36            bytevector-u32-ref bytevector-s32-ref
37            bytevector-u32-set! bytevector-s32-set!
38            bytevector-u32-native-ref bytevector-s32-native-ref
39            bytevector-u32-native-set! bytevector-s32-native-set!
41            bytevector-u64-ref bytevector-s64-ref
42            bytevector-u64-set! bytevector-s64-set!
43            bytevector-u64-native-ref bytevector-s64-native-ref
44            bytevector-u64-native-set! bytevector-s64-native-set!))
47 (load-extension "libguile-r6rs-v0" "scm_init_r6rs_bytevector")
49 (define-macro (endianness sym)
50   (if (memq sym '(big little))
51       `(quote ,sym)
52       (error "unsupported endianness" sym)))
54 ;;; arch-tag: 87dcf8cd-88a6-4489-8370-32ef5b3b1d62