From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13016 invoked by alias); 17 Apr 2008 23:10:47 -0000 Received: (qmail 13005 invoked by uid 22791); 17 Apr 2008 23:10:47 -0000 X-Spam-Check-By: sourceware.org Received: from yw-out-1718.google.com (HELO yw-out-1718.google.com) (74.125.46.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Apr 2008 23:10:17 +0000 Received: by yw-out-1718.google.com with SMTP id 6so188361ywa.80 for ; Thu, 17 Apr 2008 16:10:14 -0700 (PDT) Received: by 10.150.136.6 with SMTP id j6mr2501582ybd.117.1208473814578; Thu, 17 Apr 2008 16:10:14 -0700 (PDT) Received: from ?128.84.79.136? ( [128.84.79.136]) by mx.google.com with ESMTPS id a45sm989386rne.1.2008.04.17.16.10.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 17 Apr 2008 16:10:13 -0700 (PDT) Message-ID: <4807D8CD.20703@gmail.com> Date: Thu, 17 Apr 2008 23:10:00 -0000 From: Mehak Mahajan User-Agent: Thunderbird 2.0.0.12 (X11/20080227) MIME-Version: 1.0 To: cgen@sources.redhat.com Subject: Is there a function in cgen for parsing short integers? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00000.txt.bz2 Hi, I am porting cgen to a 16 bit architecture. The immediates are 16 bits long. I am also parsing all hex numbers as signed numbers. Hence 0xFFFF will be -1. When I parse -1, I get 0xFFFFFFFF, since cgen_parse_signed_integer accepts a long. My problem is that since the max size of immediate can only be 16 bits, I want to flag an error if the user enters an immediate like 0xFFFFFFFF. However, since -1 is parsed as a long, there is no way for me to restrict the length of the immediates to 16 bits. Is there an equivalent function for parsing short integers as well? Cheers, Mehak