Annotation of nono/lib/branchhistory.cpp, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: // ブランチ履歴
                      8: 
                      9: #include "branchhistory.h"
                     10: 
                     11: // コンストラクタ
                     12: BranchHistory::BranchHistory()
                     13: {
                     14:        monitor.Init(70, 16);
                     15: }
                     16: 
                     17: // デストラクタ
                     18: BranchHistory::~BranchHistory()
                     19: {
                     20: }
                     21: 
                     22: bool
                     23: BranchHistory::MonitorUpdate()
                     24: {
                     25:        int i;
                     26:        uint8 t;
                     27: 
                     28:        // 0         1         2         3         4         5         6
                     29:        // 0123456789012345678901234567890123456789012345678901234567890123456789
                     30:        // 01 $01234567->$01234567 x123456789  16 $01234567->$01234567 x123456789
                     31: 
                     32:        monitor.Clear();
                     33: 
                     34:        // top は現在の位置。
                     35:        // entry[] は古い順に書き込まれるが、表示は新しい順にしたい。
                     36:        // ブランチ履歴は書き込み最適化のため256エントリあるが、そんなに
                     37:        // 奥のほうが気になることはないだろう。
                     38:        t = top;
                     39:        for (i = 0; i < 32; i++) {
                     40:                BranchEntry& e = entry[t--];
                     41:                int x = (i / 16) * 36;
                     42:                int y = i % 16;
                     43:                if (e.count == 0) {
                     44:                        continue;
                     45:                }
                     46:                monitor.Print(x, y, "%02d:$%08x->$%08x", i,
                     47:                        e.from, e.to);
                     48:                if (e.count > 1) {
                     49:                        monitor.Print(x + 24, y, "x%9u", e.count);
                     50:                }
                     51:        }
                     52:        return true;
                     53: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.