This is an automated email from Gerrit.

Franck Jullien ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/1683

-- gerrit

commit 398dd0faff9275a6823246b64b129a3f6f370dd4
Author: Franck Jullien <[email protected]>
Date:   Thu Oct 3 23:17:58 2013 +0200

    jtag_vpi: use DIV_ROUND_UP
    
    Change-Id: I31d315a79a1587d7873c5b8713daf8276fa146d0
    Signed-off-by: Franck Jullien <[email protected]>

diff --git a/src/jtag/drivers/jtag_vpi.c b/src/jtag/drivers/jtag_vpi.c
index d0e90e2..d962ecf 100644
--- a/src/jtag/drivers/jtag_vpi.c
+++ b/src/jtag/drivers/jtag_vpi.c
@@ -100,7 +100,7 @@ static int jtag_vpi_tms_seq(const uint8_t *bits, int 
nb_bits)
        struct vpi_cmd vpi;
        int nb_bytes;
 
-       nb_bytes = (nb_bits / 8) + !!(nb_bits % 8);
+       nb_bytes = DIV_ROUND_UP(nb_bits, 8);
 
        vpi.cmd = CMD_TMS_SEQ;
        memcpy(vpi.buffer_out, bits, nb_bytes);
@@ -165,7 +165,7 @@ static int jtag_vpi_state_move(tap_state_t state)
 static int jtag_vpi_queue_tdi_xfer(uint8_t *bits, int nb_bits, int tap_shift)
 {
        struct vpi_cmd vpi;
-       int nb_bytes = (nb_bits / 8) + !!(nb_bits % 8);
+       int nb_bytes = DIV_ROUND_UP(nb_bits, 8);
 
        vpi.cmd = tap_shift ? CMD_SCAN_CHAIN_FLIP_TMS : CMD_SCAN_CHAIN;
 
@@ -198,7 +198,7 @@ static int jtag_vpi_queue_tdi_xfer(uint8_t *bits, int 
nb_bits, int tap_shift)
  */
 static int jtag_vpi_queue_tdi(uint8_t *bits, int nb_bits, int tap_shift)
 {
-       int nb_xfer = (nb_bits / (XFERT_MAX_SIZE * 8)) + !!(nb_bits % 
(XFERT_MAX_SIZE * 8));
+       int nb_xfer = DIV_ROUND_UP(nb_bits, XFERT_MAX_SIZE * 8);
        uint8_t *xmit_buffer = bits;
        int xmit_nb_bits = nb_bits;
        int i = 0;

-- 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to