Next: , Previous: , Up: words   [Index]


3.5.3 Verifying the range of integers

The following bindings are exported by the (vicare platform words) library.

Syntax: word? obj

Return #t if obj is a fixnum or bignum, that is an exact integer; else return #f.

Syntax: machine-word? obj

On 32-bit platforms: return #t if obj is a fixnum or bignum in the 32-bit range; on 64-bit platforms: return #t if obj is a fixnum or bignum in the 64-bit range; else return #f.

Syntax: word-u8? obj
Syntax: word-s8? obj

Return #t if obj is a signed or unsigned fixnum in the 8-bit range; else return #f.

Syntax: word-u16? obj
Syntax: word-s16? obj

Return #t if obj is a signed or unsigned fixnum in the 16-bit range; else return #f.

Syntax: word-u32? obj
Syntax: word-s32? obj

Return #t if obj is a signed or unsigned fixnum or bignum in the 32-bit range; else return #f.

Syntax: word-u64? obj
Syntax: word-s64? obj

Return #t if obj is a signed or unsigned fixnum or bignum in the 64-bit range; else return #f.

Syntax: word-u128? obj
Syntax: word-s128? obj

Return #t if obj is a signed or unsigned fixnum or bignum in the 128-bit range; else return #f.

Syntax: word-u256? obj
Syntax: word-s256? obj

Return #t if obj is a signed or unsigned fixnum or bignum in the 256-bit range; else return #f.

Syntax: unsigned-char? obj
Syntax: signed-char? obj

Return #t if obj is a fixnum in the range representable with a platform C language type signed char or unsigned char.

Syntax: unsigned-short? obj
Syntax: signed-short? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type signed short int or unsigned short int.

Syntax: unsigned-int? obj
Syntax: signed-int? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type signed int or unsigned int.

Syntax: unsigned-long? obj
Syntax: signed-long? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type signed long int or unsigned long int.

Syntax: unsigned-long-long? obj
Syntax: signed-long-long? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type signed long long int or unsigned long long int.

Syntax: pointer-integer? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type void *.

Syntax: size_t? obj
Syntax: ssize_t? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type size_t or ssize_t as defined by stddef.h.

Syntax: off_t? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type off_t as defined by stdio.h.

Syntax: ptrdiff_t? obj

Return #t if obj is a fixnum or bignum in the range representable with a platform C language type ptrdiff_t as defined by stddef.h.

The following predicates are meant to be used to validate indices in bytevectors.

Syntax: fixnum-aligned-to-2? N

Unsafe syntax: N must be a fixnum. Evaluate to #t if N is a fixnum multiple of 2; else evaluate to #f.

Syntax: fixnum-aligned-to-4? N

Unsafe syntax: N must be a fixnum. Evaluate to #t if N is a fixnum multiple of 4; else evaluate to #f.

Syntax: fixnum-aligned-to-8? N

Unsafe syntax: N must be a fixnum. Evaluate to #t if N is a fixnum multiple of 8; else evaluate to #f.

Syntax: fixnum-aligned-to? N alignment

Unsafe syntax: N and alignment must be fixnums. Evaluate to #t if N is a fixnum multiple of alignment; else evaluate to #f.


Next: , Previous: , Up: words   [Index]