152419Sjulian/*
252419Sjulian * CDDL HEADER START
379727Sschweikh *
452419Sjulian * This file and its contents are supplied under the terms of the
552419Sjulian * Common Development and Distribution License ("CDDL"), version 1.0.
652419Sjulian * You may only use this file in accordance with the terms of version
752419Sjulian * 1.0 of the CDDL.
852419Sjulian *
952419Sjulian * A full copy of the text of the CDDL should have accompanied this
1052419Sjulian * source.  A copy of the CDDL is also available via the Internet at
1152419Sjulian * http://www.illumos.org/license/CDDL.
1252419Sjulian *
1352419Sjulian * CDDL HEADER END
1479727Sschweikh */
1552419Sjulian
1652419Sjulian/*
1752419Sjulian * Copyright (c) 2012 by Delphix. All rights reserved.
1852419Sjulian */
1952419Sjulian
2052419Sjulian/*
2152419Sjulian * Test execution-time casting between integer types of different size.
2252419Sjulian */
2352419Sjulian
2452419Sjulian#pragma D option quiet
2552419Sjulian
2652419Sjulianint64_t x;
2752419Sjulian
2852419SjulianBEGIN
2952419Sjulian{
3052419Sjulian	z = 0xfff0;
3152419Sjulian
3279727Sschweikh	x = (int32_t)(int16_t)z;
3367627Sasmodai	printf("%16x %20d %20u\n", x, x, x);
3452419Sjulian	x = (int32_t)(uint16_t)z;
3552419Sjulian	printf("%16x %20d %20u\n", x, x, x);
3652419Sjulian	x = (uint32_t)(int16_t)z;
3752419Sjulian	printf("%16x %20d %20u\n", x, x, x);
3852419Sjulian	x = (uint32_t)(uint16_t)z;
3959982Sarchie	printf("%16x %20d %20u\n", x, x, x);
4079538Sru	printf("\n");
4152419Sjulian
4252419Sjulian	x = (int16_t)(int32_t)z;
4352419Sjulian	printf("%16x %20d %20u\n", x, x, x);
4452419Sjulian	x = (int16_t)(uint32_t)z;
4584306Sru	printf("%16x %20d %20u\n", x, x, x);
4652419Sjulian	x = (uint16_t)(int32_t)z;
4752419Sjulian	printf("%16x %20d %20u\n", x, x, x);
4852419Sjulian	x = (uint16_t)(uint32_t)z;
4952419Sjulian	printf("%16x %20d %20u\n", x, x, x);
5052419Sjulian
5152419Sjulian	exit(0);
5252419Sjulian}
5352419Sjulian