1239385Smm/* 2239385Smm * CDDL HEADER START 3239385Smm * 4239385Smm * This file and its contents are supplied under the terms of the 5239385Smm * Common Development and Distribution License ("CDDL"), version 1.0. 6239385Smm * You may only use this file in accordance with the terms of version 7239385Smm * 1.0 of the CDDL. 8239385Smm * 9239385Smm * A full copy of the text of the CDDL should have accompanied this 10239385Smm * source. A copy of the CDDL is also available via the Internet at 11239385Smm * http://www.illumos.org/license/CDDL. 12239385Smm * 13239385Smm * CDDL HEADER END 14239385Smm */ 15239385Smm 16239385Smm/* 17239385Smm * Copyright (c) 2012 by Delphix. All rights reserved. 18239385Smm */ 19239385Smm 20239385Smm/* 21239385Smm * Test execution-time casting between integer types of different size. 22239385Smm */ 23239385Smm 24239385Smm#pragma D option quiet 25239385Smm 26239385Smmint64_t x; 27239385Smm 28239385SmmBEGIN 29239385Smm{ 30239385Smm z = 0xfff0; 31239385Smm 32239385Smm x = (int32_t)(int16_t)z; 33239385Smm printf("%16x %20d %20u\n", x, x, x); 34239385Smm x = (int32_t)(uint16_t)z; 35239385Smm printf("%16x %20d %20u\n", x, x, x); 36239385Smm x = (uint32_t)(int16_t)z; 37239385Smm printf("%16x %20d %20u\n", x, x, x); 38239385Smm x = (uint32_t)(uint16_t)z; 39239385Smm printf("%16x %20d %20u\n", x, x, x); 40239385Smm printf("\n"); 41239385Smm 42239385Smm x = (int16_t)(int32_t)z; 43239385Smm printf("%16x %20d %20u\n", x, x, x); 44239385Smm x = (int16_t)(uint32_t)z; 45239385Smm printf("%16x %20d %20u\n", x, x, x); 46239385Smm x = (uint16_t)(int32_t)z; 47239385Smm printf("%16x %20d %20u\n", x, x, x); 48239385Smm x = (uint16_t)(uint32_t)z; 49239385Smm printf("%16x %20d %20u\n", x, x, x); 50239385Smm 51239385Smm exit(0); 52239385Smm} 53