From owner-freebsd-usb@FreeBSD.ORG Mon Aug 30 02:02:36 2010 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864661065698 for ; Mon, 30 Aug 2010 02:02:36 +0000 (UTC) (envelope-from kc5vdj.freebsd@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 46CFB8FC14 for ; Mon, 30 Aug 2010 02:02:36 +0000 (UTC) Received: by iwn36 with SMTP id 36so5086195iwn.13 for ; Sun, 29 Aug 2010 19:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=kbkh/vS9M1ZiruT4nX+r64MRowVv5muqyFbRxhYeFQo=; b=iFKourNC9dsIrIGyJKPkeGFvpMot5Qs5cI6qGN313FWevz3mq1EFYd2aKacXy04+ah yJ6glynyUSFzF/b+GlCcI7Jai1ySP/516q5yPJ4Jq62NABWtNcxaXMpYpLxPRuhc6ct8 8pTTiSB/FysBYrACmnaftTOWKc2iUuugVGBXM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=dUj7Ae9epL1Rj9oZKojhoRa5memoSt6tgHcYyrrnfXLu6XTahsfF+He4Nb/HW2wL8R LI2SPoJGVXUKjPqRwFsOUz6geNC/joKnEuMbU51AS/REx2HlZ5iZOkao1BBOYiGD48w9 cXANHFZrop9swCphI12NpRJ+jjYT5clNHfdcU= Received: by 10.231.19.6 with SMTP id y6mr4512865iba.16.1283133755315; Sun, 29 Aug 2010 19:02:35 -0700 (PDT) Received: from orb.electron-tube.net (71-217-215-181.cdrr.qwest.net [71.217.215.181]) by mx.google.com with ESMTPS id r3sm6850628ibk.19.2010.08.29.19.02.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 29 Aug 2010 19:02:34 -0700 (PDT) Message-ID: <4C7B1139.4050106@gmail.com> Date: Sun, 29 Aug 2010 21:02:33 -0500 From: Jim Bryant User-Agent: Thunderbird 2.0.0.24 (X11/20100731) MIME-Version: 1.0 To: perryh@pluto.rain.com References: <4C76AB76.4070806@gmail.com> <201008270856.43512.hselasky@c2i.net> <4C777D12.3040900@gmail.com> <201008271053.27731.hselasky@c2i.net> <4C78B0F4.4020002@gmail.com> <4c799393.wU/d2YpTieErDrD7%perryh@pluto.rain.com> In-Reply-To: <4c799393.wU/d2YpTieErDrD7%perryh@pluto.rain.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org Subject: Re: writing usb drivers under 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 02:02:36 -0000 ummmm.. you were saying??? 8:58:44pm orb(19): cat bs3.c #include int main(void) { int toshiftornottoshift = 0x8000; printf("%d\n", toshiftornottoshift); return(0); } 8:58:48pm orb(20): cc -S -O2 -o bs3.s bs3.c 8:58:53pm orb(21): cat bs3.s .file "bs3.c" .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "%d\n" .text .p2align 4,,15 .globl main .type main, @function main: .LFB3: subq $8, %rsp .LCFI0: /* * this doesn't look like the compiler generates a shift to me. */ movl $32768, %esi movl $.LC0, %edi xorl %eax, %eax call printf xorl %eax, %eax addq $8, %rsp ret .LFE3: .size main, .-main .section .eh_frame,"a",@progbits .Lframe1: .long .LECIE1-.LSCIE1 .LSCIE1: .long 0x0 .byte 0x1 .string "zR" .uleb128 0x1 .sleb128 -8 .byte 0x10 .uleb128 0x1 .byte 0x3 .byte 0xc .uleb128 0x7 .uleb128 0x8 .byte 0x90 .uleb128 0x1 .align 8 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 .LASFDE1: .long .LASFDE1-.Lframe1 .long .LFB3 .long .LFE3-.LFB3 .uleb128 0x0 .byte 0x4 .long .LCFI0-.LFB3 .byte 0xe .uleb128 0x10 .align 8 .LEFDE1: .ident "GCC: (GNU) 4.2.1 20070719 [FreeBSD]" perryh@pluto.rain.com wrote: > Jim Bryant wrote: > > >> what kind of idiot defines a constant assignment for a 32k buffer as a >> 15 bit left shift of 1? >> >> clever, yes. but in production, stupid. >> >> a constant should be just that, a constant, and thus require no >> computation at runtime. >> > > Er, did you bother to look at the generated code before spouting off? > Most compilers, even as far back as K&R 1st edition, will compute > constant expressions like that at compile time. > >