Skip to content
Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › Converting Data Types › CUnsg

CUnsg

Converts a signed value to unsigned, so division and shifts treat it as unsigned.

Syntax

CUnsg ( expression )

Remarks

Usage

variable = CUnsg ( expression )
Converts a signed expression to an unsigned one, useful to force unsigned behavior of division or multiplication (including with Shl and Shr).

This is the opposite of CSign.

Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Cunsg.

Differences from QB

  • New to FreeBASIC

See also

Examples

Dim value As Short = -1

Print CUnsg(value)  '' will print 65535

Category: Converting Data Types
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally