public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Motoya Kurotsu <kurotsu@allied-telesis.co.jp>
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] diag_printf, long long
Date: Thu, 12 Jul 2001 20:35:00 -0000	[thread overview]
Message-ID: <20010713122744.A1139@white.office1> (raw)

Hi,

I guess that diag_printf can't handle long long type of integers, at least
as far as with the gcc for 32 bit mips.
Below is the program to prove it.

#include <cyg/infra/diag.h>     // diag_printf
#include <stdio.h>              // printf
void cyg_user_start(void)
{
        unsigned long t1=0xaa00aa00;
        unsigned long long t2=0x22002200bb00bb00;
        unsigned long long t3=0x33003300cc00cc00;

        diag_printf("diag : t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3);
        printf("stdio: t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3);
        diag_printf("diag : t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3);
        printf("stdio: t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3);
        diag_printf("diag : t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1);
        printf("stdio: t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1);
	for(;;);
}

The attachment is my patch for this problem. I think this works with
32-bit compiler. But I suspect it does so with 64 bit compiler.
If you find anything or have better idea, please suggest me. 

Thank you in advance.

Regards,
Motoya Kurotsu
Alilled Telesis K.K.
-----------------------------------------------

--- diag.cxx.orig	Thu Jul 12 13:53:32 2001
+++ diag.cxx	Thu Jul 12 14:34:56 2001
@@ -262,6 +262,9 @@
 
 externC void diag_vprintf( const char *fmt, CYG_ADDRWORD *args)
 {
+
+    cyg_bool pad = true;
+
     if( !diag_check_string(fmt) )
     {
         int i;
@@ -309,6 +312,13 @@
                 }
             }
 
+            if (long_op) {
+                    if(pad) args++;
+                    pad=false;
+            } else {
+                    pad=!pad;
+            }
+		
             switch( c )
             {
             case 'd':

             reply	other threads:[~2001-07-12 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 20:35 Motoya Kurotsu [this message]
2001-07-13 13:31 ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010713122744.A1139@white.office1 \
    --to=kurotsu@allied-telesis.co.jp \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).