🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #257877

--

#257877
From: Jeff-Relf.Me
Date: Thu, 12 Jun 2014 07:13
50 lines
3733 bytes
<PRE Style='White-Space: PRE !important; Font-Size: 18px !important;Font-Family: monospace !important;'> 
@coyo,  You wrote:
> I still say everyone should use UTF-32 instead of UTF-8. 

UTF·32 has few advantages, I think.
Few have the fonts for it... very few.

> imagine how much more efficient Base64 encoding would be 
> if you could use Unicode codepoints with 
> a full static codepoint-to-byte mapping?

I use Base·360.

Note, however, I do it for the shorter strings,
on the display... it doesn't save diskspace.

>From &lt;http://Jeff-Relf.Me/X.CPP>:

  const wchar_t Digits[] = //  In code·point order, for binary search.
    L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    L"ȴȵȶȷȸȹȺȻȼȽȾȿɀɁɄɅɌɍɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂ"
    L"ʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯ"

    L"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψω"
    L"ϐϑϒϓϕϖϗϘϙϚϛϜϝϞϟϠϡϰϱϲϳϴϵ϶ϷϸϹϺϻϼϽϾϿ"

    L"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
    L"აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵ";
  const uint Base·360 = ( sizeof Digits - 1 ) / szChr ;
  const int  mxDigits = 9 ;  //  ln(2^64)/ln(360) + 2 = 

  LnP u64·toBase·360( u64 N ) { int K ;  

    static wchar_t Uni [ mxDigits + 1 ];  LnP  Left = Uni + mxDigits ;  *Left = 0 ;
    
    do { K = N % Base·360, N /= Base·360, *--Left = Digits[ K ];  } while( N );
    return  Left ;  }

  float Base·360·To·DaysAgo( LnP B·Num·Ln ) {
    wchar_t Ch0, Ch, Ch2, Ch3 ;  u64 i = 0 ; 
   
    LnP  B0 = (LnP)Digits, p, E0 = B0 + Base·360, B·Num, B = B·Num·Ln, P, E = 0 ;
    WhileBac( Ch != L'·' && Ch != 32 );  
    if ( !Ch ) return 0 ;  B·Num = ++P ;
    While( Ch ) { p = B = B0, E = E0 ;
    
      Find:    if ( B >= E0 ) return 0 ;  p = B + ( E - B ) / 2, Ch3 = *p ;
      if ( Ch > Ch3 ) { if ( B = ++p, B > E ) return 0 ; goto Find ;  }
      if ( Ch < Ch3 ) { if ( E = --p, E < B ) return 0 ; goto Find ;  } 
      i *= Base·360, i += p - B0 ;  }  return gDaysAgo( i ) ;  }
Technical Details
Message-ID: <Jeff-Relf.Me@Jun.12{0.13.Seattle.2014}>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!nntpswitch.blueworldhosting.com!not-for-mail
References: <537f7304$15$fuzhry+tra$mr2ice@news.patriot.net> <AABTgbui+zwAAAIC.A1.flnews@WStation1.micha.freeshell.org> <538204e6$25$fuzhry+tra$mr2ice@news.patriot.net> <AABTgvX5CpQAAAVK.A1.flnews@WStation2.stz-e.de> <e0wsauyydj4t.ezircgcdijib.dlg@40tude.net> <S7qdnWXBk4JHkATOnZ2dnUVZ_t-dnZ2d@giganews.com>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff-Relf.Me@Jun.12{0.13.Seattle.2014}>
Subject: --
Date: Thu, 12 Jun 2014 07:13:03 +0000
From: Jeff-Relf.Me <@.>
References: <537f7304$15$fuzhry+tra$mr2ice@news.patriot.net> <AABTgbui+zwAAAIC.A1.flnews@WStation1.micha.freeshell.org> <538204e6$25$fuzhry+tra$mr2ice@news.patriot.net> <AABTgvX5CpQAAAVK.A1.flnews@WStation2.stz-e.de> <e0wsauyydj4t.ezircgcdijib.dlg@40tude.net> <S7qdnWXBk4JHkATOnZ2dnUVZ_t-dnZ2d@giganews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!nntpswitch.blueworldhosting.com!not-for-mail
Content-Type: Text/HTML; charset=UTF-8
Content-Transfer-Encoding: 8bit
Newsgroups: news.software.readers
User-Agent: Jeff-Relf.Me/X.HTM
X-Complaints-To: abuse@blueworldhosting.com
Organization: BWH Usenet NNTPSwitch-Cluster
Lines: 50
NNTP-Posting-Date: Thu, 12 Jun 2014 02:13:03 -0500
X-Trace: 18f05539952ffec90b8a605362
X-Original-Bytes: 3471