e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal/*
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * CDDL HEADER START
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal *
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * This file and its contents are supplied under the terms of the
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * Common Development and Distribution License ("CDDL"), version 1.0.
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * You may only use this file in accordance with the terms of version
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * 1.0 of the CDDL.
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal *
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * A full copy of the text of the CDDL should have accompanied this
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * source. A copy of the CDDL is also available via the Internet at
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * http://www.illumos.org/license/CDDL.
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal *
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * CDDL HEADER END
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal */
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal/*
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * Copyright (c) 2012 by Delphix. All rights reserved.
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal */
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal/*
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal * Test execution-time casting between integer types of different size.
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal */
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal#pragma D option quiet
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhalint64_t x;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. LeventhalBEGIN
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal{
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal z = 0xfff0;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (int32_t)(int16_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (int32_t)(uint16_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (uint32_t)(int16_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (uint32_t)(uint16_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("\n");
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (int16_t)(int32_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (int16_t)(uint32_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (uint16_t)(int32_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal x = (uint16_t)(uint32_t)z;
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal printf("%16x %20d %20u\n", x, x, x);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal exit(0);
e5803b76927480e8f9b67b22201c484ccf4c2bcfAdam H. Leventhal}